简单输出JSON字符串
程序员文章站
2024-01-04 11:59:04
...
本人不懂PHP想请问下,下面这段代码输出的json字符串是社么?
class pic_data{ public $data; public $status; public $statusText; public function __construct() { $this->data->urls = array(); }}$d = new pic_data();$d->data->photoId = 'photoId123';$d->data->urls[0] = 'url123';$d->status = 1;$d->statusText = '上传成功!';$msg = json_encode($d);echo $msg;
回复讨论(解决方案)
{"data":{"urls":["url123"],"photoId":"photoId123"},"status":1,"statusText":"\u4e0a\u4f20\u6210\u529f!"}
和对象有关的一些信息,包括对象Id等一些
{"data":{"urls":["url123"],"photoId":"photoId123"},"status":1,"statusText":"\u4e0a\u4f20\u6210\u529f!"}
具体含义只用你知道
json格式,json解析,json格式在线校验工具 www.kjson.com