关于YII框架Response content must not be an array的解决方法


 

public function actionGet_permissions()
{
    \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
    return Auth_Item::find()->where(['owner_user_id' => NULL])->all();
}

就是在要输出的代码之前 加上

\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM