Answer the question
In order to leave comments, you need to log in
What is wrong with Setting read-only property: yii\web\Application::response?
There is a simple code in the controller, the task of which is to give data in the form of JSON
public function actionGroupList($id){
Yii::$app->response = Response::FORMAT_JSON;
$groupList = CatalogHelper::getGroupList($id);
return $groupList;
}
Invalid Call – yii\base\InvalidCallException
Setting read-only property: yii\web\Application::response
public function actionInfo()
{
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
return [
'message' => 'hello world',
'code' => 100,
];
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question