1
我有以下代碼:如何在yii 1中編碼JSON中的attributeLables和值?
$model = new JsonForms();
$model->name = $this->name;
$model->json = json_encode($this-> attributes);
而且$model->json = json_encode($this-> attributes);
按以下格式編碼的數據:
{"t_name":"sdf","owner_name":"sdfgsdfg","telegram_number":null, "j_address":null}
這裏t_name,OWNER_NAME等都是變量。我需要在下面顯示的格式標記名稱,而不是變量(例如t_name
的名字(名字是attributeLabels,或owner_name
作爲所有者))保存:
{"First Name":"sdf","Owner":"sdfgsdfg","Telegram Number":null, "Address":null}
我該怎麼辦呢?
它只返回數組 – phpdev
@phpdev誰*它*?你把'CJSON :: encode'分配給了什麼? – Justinas