我的控制器中有以下代码:
public function actionCabinet($id){
$this->render('cabinet', array('model'=>$this->loadJson($id)) );
}
public function loadJson($id)
{
$jsonfile=ChForms::model()->findByPk($id, array("select"=>"json"));
$decodedJson=json_decode($jsonfile, true);
return $decodedJson;
}
数据以 json 格式保存在 ChForm 中的 json 字段中。我要把它转换成数组。当我运行此应用程序时,它显示以下错误消息:
json_decode() expects parameter 1 to be string, object given
我该如何解决这个错误?