Home > Backend Development > PHP Tutorial > 大括号是什么意思

大括号是什么意思

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:17:33
Original
2538 people have browsed it

<code>$result={"total":2,"pages":1,"pic":[{"id":"1","name":"1"},{"id":"1","name":"1"}]}

</code>
Copy after login
Copy after login

①大括号是什么意思。

②怎么获取pic中的name

麻烦大神解惑,谢谢了...

回复内容:

<code>$result={"total":2,"pages":1,"pic":[{"id":"1","name":"1"},{"id":"1","name":"1"}]}

</code>
Copy after login
Copy after login

①大括号是什么意思。

②怎么获取pic中的name

麻烦大神解惑,谢谢了...

楼主,你的写法是不对的吧,这个$result,应该是发过来的json吧,那么应该是一个字符串啊,你需要用json_decode解析为对象啊:

<code>$result = json_decode('{"total":2,"pages":1,"pic":[{"id":"1","name":"1"},{"id":"1","name":"1"}]}');
$name = $result->pic[0]->name;</code>
Copy after login

你看看数组,对象,json这些概念吧

Related labels:
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template