我有以下代码:
$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
,作为 First Name(first name is attributeLabels, or owner_name
as Owner)):
{"First Name":"sdf","Owner":"sdfgsdfg","Telegram Number":null, "Address":null}
我该怎么做?