Home > Backend Development > PHP Tutorial > 简单输出JSON字符串

简单输出JSON字符串

WBOY
Release: 2016-06-23 14:08:37
Original
1221 people have browsed it

本人不懂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;
Copy after login


回复讨论(解决方案)

{"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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template