php 循环输出 json 数组
{"code":1,"msg":"\u67e5\u8be2\u8ba2\u5355\u8bb0\u5f55\u6210\u529f\uff01","data":[{"tr...
{"code":1,"msg":"\u67e5\u8be2\u8ba2\u5355\u8bb0\u5f55\u6210\u529f\uff01","data":[{"trade_no":"2018011721515397116","0":"2018011721515397116","out_trade_no":"2018011755100515","1":"2018011755100515","notify_url":"http:\/\/localhost:33\/req\/pay\/notify_url.php","2":"http:\/\/localhost:33\/req\/pay\/notify_url.php","return_url":"http:\/\/localhost:33\/req\/pay\/return_url.php","3":"http:\/\/localhost:33\/req\/pay\/return_url.php","type":"alipay","4":"alipay","buyer":"","5":"","pid":"1177","6":"1177","addtime":"2018-01-17 21:51:53","7":"2018-01-17 21:51:53","endtime":"2018-01-17 21:52:12","8":"2018-01-17 21:52:12","name":"\u6d4b\u8bd5","9":"\u6d4b\u8bd5","money":"0.01","10":"0.01","status":"1","11":"1","domain":"localhost","12":"localhost","ip":"116.20.26.77","13":"116.20.26.77"},{"trade_no":"2018011721155484691","0":"2018011721155484691","out_trade_no":"2018011799555251","1":"2018011799555251","notify_url":"http:\/\/\/req\/pay\/notify_url.php","2":"http:\/\/\/req\/pay\/notify_url.php","return_url":"http:\/\/\/req\/pay\/return_url.php","3":"http:\/\/\/req\/pay\/return_url.php","type":"alipay","4":"alipay","buyer":"","5":"","pid":"1177","6":"1177","addtime":"2018-01-17 21:15:54","7":"2018-01-17 21:15:54","endtime":"2018-01-17 21:16:25","8":"2018-01-17 21:16:25","name":"\u6d4b\u8bd5","9":"\u6d4b\u8bd5","money":"0.01","10":"0.01","status":"1","11":"1","domain":"","12":"","ip":"116.20.26.77","13":"116.20.26.77"}]}
这样子的数据
如何用php 循环把他们输出来? 展开
这样子的数据
如何用php 循环把他们输出来? 展开
1个回答
展开全部
<?php
$Tdata='[{"A_Name":"a1","ICNo":"","A_ContNo":"","A_QQNo":""},{"A_Name":"a2","ICNo":"","A_ContNo":"","A_QQNo":""},{"A_Name":"a3","ICNo":"","A_ContNo":"","A_QQNo":""}]';
$arr=json_decode($Tdata,true);
//var_dump($arr);
echo stripcslashes ($arr[0][A_Name]);
?>
上面的方法可以打印输出,json_decode($Tdata)输出的结果是一个对应,而json_decode($Tdata,true)输出的是一个数组
$Tdata='[{"A_Name":"a1","ICNo":"","A_ContNo":"","A_QQNo":""},{"A_Name":"a2","ICNo":"","A_ContNo":"","A_QQNo":""},{"A_Name":"a3","ICNo":"","A_ContNo":"","A_QQNo":""}]';
$arr=json_decode($Tdata,true);
//var_dump($arr);
echo stripcslashes ($arr[0][A_Name]);
?>
上面的方法可以打印输出,json_decode($Tdata)输出的结果是一个对应,而json_decode($Tdata,true)输出的是一个数组
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询