Home >Backend Development >PHP Tutorial >大括号是什么意思
<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这些概念吧