获取某一元素有关问题,

WBOY
发布: 2016-06-13 13:27:03
原创
1011 人浏览过

获取某一元素问题,急
{"head":[{"visitcode":"sjbtg","resultCode":"0"}],"content":[{"userID":"15611030868","productID":"3111007900 ","orderTime":"2012-06-19","orderType":"1","orderresult":"6","orderremark":"输入的产品ID不存在","baseLine":"","orderField":""},{"userID":"","productID":"","orderTime":"","orderType":"1","orderresult":"1","orderremark":"输入必选参数为空","baseLine":"","orderField":""},{"userID":"","productID":"","orderTime":"","orderType":"1","orderresult":"1","orderremark":"输入必选参数为空","baseLine":""}]} 

怎么得到其中"orderresult":"6"的值,也就是6

------解决方案--------------------
$s = '{"head":[{"visitcode":"sjbtg","resultCode":"0"}],"content":[{"userID":"15611030868","productID":"3111007900 ","orderTime":"2012-06-19","orderType":"1","orderresult":"6","orderremark":"输入的产品ID不存在","baseLine":"","orderField":""},{"userID":"","productID":"","orderTime":"","orderType":"1","orderresult":"1","orderremark":"输入必选参数为空","baseLine":"","orderField":""},{"userID":"","productID":"","orderTime":"","orderType":"1","orderresult":"1","orderremark":"输入必选参数为空","baseLine":""}]} ';

echo json_decode($s)->content[0]->orderresult; //6

------解决方案--------------------

探讨

$s = '{"head":[{"visitcode":"sjbtg","resultCode":"0"}],"content":[{"userID":"15611030868","productID":"3111007900 ","orderTime":"2012-06-19","orderType":"1","orderresult":"6","orderremark":"输入的产品ID不存……
相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板