这是我的带有 PHP 输出的 Json 代码
$buffer = '[{"isSuccess":"true","message":"Consignment Number Valid","orderReferenceIdList":[":Succesfull"],"tracking_Details":[{"BookingDate":"02-05-2020","Destination":"MANDI BAHAUDDIN","Origin":"LAHORE","Shipper":"VESTURE MERCHANDISING (OTURE)","Consignee":"Syed Asad Abbas Bokhari","ServiceType":"Overnight","CNStatus":"DELIVERED","CNStatusID":"55","pieces":"1","weight":"0.5","Details":[{"DateTime":"5/5/2020 12:03:59 PM","Status":"Delivered","Location":"MANDI BAHAUDDIN","Detail":"Shipment has been Delivered. Delivery Date & Time May 5 2020 1:11AM and Received By: ASAD"},{"DateTime":"5/5/2020 10:03:58 AM","Status":"On Delivery","Location":"MANDI BAHAUDDIN","Detail":"Shipment is Out for Delivery."},{"DateTime":"5/4/2020 10:43:51 AM","Status":"On Delivery","Location":"MANDI BAHAUDDIN","Detail":"Shipment is Out for Delivery."},{"DateTime":"5/4/2020 10:06:57 AM","Status":"Unloading","Location":"MANDI BAHAUDDIN","Detail":"Shipment has arrived at hub."},{"DateTime":"5/4/2020 3:55:10 AM","Status":"Loading","Location":"GUJRANWALA","Detail":"Shipment has departed."},{"DateTime":"5/2/2020 11:20:44 PM","Status":"Unloading","Location":"Lahore Airport","Detail":"Shipment has arrived at hub."},{"DateTime":"5/2/2020 10:40:33 PM","Status":"Loading","Location":"KOT LAKH PAT","Detail":"Shipment has departed."},{"DateTime":"5/2/2020 8:30:52 PM","Status":"Arrived at OPS","Location":"LAHORE","Detail":"Shipment has arrived at origin facility."},{"DateTime":"5/2/2020 12:00:00 AM","Status":"Booking","Location":"LAHORE","Detail":"Shipment is booked."}]}]}]1';
$data = json_decode($buffer, true);
foreach ($data['tracking_Details'] as $a) {
echo $a['BookingDate'];
}
这是一个JSON美化在线工具结果:https ://i.imgur.com/c5izkQH.png
但是回声的输出什么也没有。如何在 PHP 中输出 JSON?
慕无忌1623718
凤凰求蛊