你给出的数据,用json_decode格式化成数组,然后访问数组就行了。另外:你给的数据有问题,如果不懂就不要乱改,改出来的容易引起误会。
例子
[mw_shl_code=php,true]<?php
$str = '{"school_id":"203","file_list":[{"file_id":20301,"url":"http:\/\/www.baidu.com\/school\/20301.jpg","size":3260,"pid":1005},{"file_id":20302,"url":"http:\/\/www.baidu.com\/school\/20302.jpg","size":1043,"pid":320},{"file_id":20303,"url":"http:\/\/www.baidu.com\/school\/20303.jpg","size":8294,"pid":256},{"file_id":20304,"url":"http:\/\/www.baidu.com\/school\/20304.jpg","size":4221,"pid":128}]}';
$obj = json_decode($str, true);
foreach($obj['file_list'] as $key => $val){
echo $val['url'].' PID:'.$val['pid'].'<br />';
}[/mw_shl_code] |