时间:2021-07-01 10:21:17 帮助过:104人阅读
$result={"total":2,"pages":1,"pic":[{"id":"1","name":"1"},{"id":"1","name":"1"}]}
①大括号是什么意思。
②怎么获取pic中的name
麻烦大神解惑,谢谢了...
$result={"total":2,"pages":1,"pic":[{"id":"1","name":"1"},{"id":"1","name":"1"}]}
①大括号是什么意思。
②怎么获取pic中的name
麻烦大神解惑,谢谢了...
楼主,你的写法是不对的吧,这个$result
,应该是发过来的json
吧,那么应该是一个字符串啊,你需要用json_decode
解析为对象啊:
$result = json_decode('{"total":2,"pages":1,"pic":[{"id":"1","name":"1"},{"id":"1","name":"1"}]}');
$name = $result->pic[0]->name;
你看看数组,对象,json这些概念吧