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

大括号是什么意思

WBOY
WBOYOriginal
2016-06-06 20:17:332472browse

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

</code>

①大括号是什么意思。

②怎么获取pic中的name

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

回复内容:

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

</code>

①大括号是什么意思。

②怎么获取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>

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

Statement:
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
Previous article:php类继承的问题Next article:什么时候该用return呢?