Exception 'yii\base\InvalidArgumentException' with message 'Response content must not be an array.' in C:\xampp1\htdocs\advanced\vendor\yiisoft\yii2\web\Response.php:1054
Stack trace:
0 C:\xampp1\htdocs\advanced\vendor\yiisoft\yii2\web\Response.php(337): yii\web\Response->prepare()
1 C:\xampp1\htdocs\advanced\vendor\yiisoft\yii2\base\Application.php(392): yii\web\Response->send()
2 C:\xampp1\htdocs\advanced\frontend\web\index.php(17): yii\base\Application->run()
3 {main}
SiteController.php
public function actionGetuser()
{
$model = new UsersData();
if(Yii::$app->request->isAjax){
$id = Yii::$app->request->post();
return $model->get($id);
}
}
model:-
function get($id)
{
$model = Yii::$app->db->createCommand("SELECT * FROM user where id=$id");
return $user = $model->queryOne();
}