如何在yii 1中调用视图中的解码json字段值

I have following code in my controller:

$model=ChForms::model()->findByPk($id);
$decode= $model->json;
$res=CJSON::decode($decode);
var_dump($res);
return $this->render('index', array('model'=>$model, 'res'=>$res));

the result of var_dump($res) is:

["p_2"]=> string(4) "test" ["p_3"]=> string(1) "0" 

How can I call values of ["p_2"] and ["p_3"] in my view(e.g test, 0)

CJSON::decode() returns an array by default. Since you are passing $res into your view you can access the required fields via $res["p_2"] and $res["p_3"].