$res = News::findOne($new_id)->toArray();
yii框架的多表聯查:
controller層:
//news 與 news_theme 是多對一的關系
$infomsg=News::find()->with('newstheme')->asArray()->all();
model層:News
//news 與 news_theme 進行兩表聯查 多對一
public function getNewstheme()
{
return $this->hasOne(NewsTheme::className(), ['id' => 'news_theme_id']);
}