php 解析java传过来的json数据
Posted *琴
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 解析java传过来的json数据相关的知识,希望对你有一定的参考价值。
例如:
java所传json数据:
array(1) { ["info"]=> string(1437) "{"error_data":[{"error_info":"通道绑卡失败","mobile":"15605139548","detail_no":"201709211201019981","error_no":"30001"},{"error_info":"通道绑卡失 败","mobile":"13478102079","detail_no":"201709211201018214","error_no":"30001"}],"finish_datetime":"2017-09-21 12:01:11","order_info":"批量注册处理完成","order_no":"201709211201016363","order_status":"1",
"recode":"10000","remsg":"成功","signdata":"4421e04ef428d737ab6f9f224a6d8e25","success_data":[{"mobile":"13710921452","detail_no":"201709211201019133","platcust":"2017092112005150310067"},{"mobile":"18600460669","detail_no":"201709211201012069","platcust":"2017092112005334410068"},{"mobile":"13751321821","detail_no":"201709211201014925","platcust":"2017092112005739210069"},{"mobile":"13080869423","detail_no":"201709211201018240","platcust":"2017092112005780910070"},{"mobile":"17135507511","detail_no":"201709211201018871","platcust":"2017092112005968910071"},{"mobile":"18602133601","detail_no":"201709211201019108","platcust":"2017092112010202010072"},{"mobile":"13859868072","detail_no":"201709211201018658","platcust":"2017092112010601510073"},{"mobile":"15295535329","detail_no":"201709211201017890","platcust":"2017092112010809410074"},{"mobile":"13945885123","detail_no":"20170921120101600","platcust":"2017092112011011410075"},{"mobile":"13958139196","detail_no":"201709211201011970","platcust":"2017092112011172610076"}],"success_num":10,"total_num":12}" }
php转化成数组形式:
$list_arr=json_decode($res[‘info‘],true);
foreach ($list_arr[‘error_data‘] as $v){
var_dump($v);
}
以上是关于php 解析java传过来的json数据的主要内容,如果未能解决你的问题,请参考以下文章
PHP 怎么解析远程URL 传过来json ,在前端显示出来