塘沽区", "汉沽区", "大港区", "东丽区", "西青区", "津南区", "北辰区", "武清区", "宝坻区", "宁河县", "静海县", "蓟 县"]
}]
}]
下面使用PHP的foreach...进行循环输出:
$str = '[{"name":"北京","city":[{"name":"北京","area":["东城区","西城区","崇文区","宣武区","朝阳区","丰台区","石景山区"...echo ':', $city['name'], '';
echo '
';
foreach($city['area'] as $area){
echo... '----', $area, '';
echo '
';
}
}
}
exit;
最后输出结果如下:
image.png
以上就是PHP循环读取json...数据的方法的全部内容