Home > Backend Development > PHP Tutorial > php怎么提取json当中的数据,

php怎么提取json当中的数据,

WBOY
Release: 2016-06-13 11:55:22
Original
1771 people have browsed it

php如何提取json当中的数据,急急急!!!
我现在在研究百度地图的API,碰到一些问题
比如我已经提取到这样的信息,信息在 http://likeapp.duapp.com/yx/4.php,可是这里面的内容非常多,百度对字段的解释是这样的http://developer.baidu.com/map/direction-api.htm#place8_3
我该如何提取stepInstruction这个字段的数据啊,求高手回答
------解决方案--------------------
json_decode
------解决方案--------------------
设你打印出的那个数组名为 $ar,则

array_walk_recursive($ar, function($v, $k) { if($k == 'stepInstruction') echo $v; });<br />
Copy after login

得:
乘坐12路(或16路,8路,2路步行360米,到达终点站乘坐19路(或28路步行270米,到达终点站乘坐17路,经过3站,到达山水人家站步行820米,到达终点站

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template