我对 php 和 JSON 有点陌生,在四处寻找回应后我找不到一个,我希望你能帮助我……</p>
我正在处理带有 JSON 响应的报告 JSON 响应看起来有点像这样:
stdClass Object
(
[FlightInformation] => stdClass Object
(
[@size] => 10
[Itinerary] => Array
(
[0] => stdClass Object
(
[bookingID] => 123456789
[creationDate] => 10/04/2012
[Customer] => stdClass Object
(
[email] => someone@aol.com
)
[FlightConfirmation] => stdClass Object
(
[supplierId] => AA
[arrivalDate] => 10/04/2012
[departureDate] => 10/05/2012
[confirmationNumber] => 0987654321
[RateInformation] => stdClass Object
(
[@size] => 1
[RateDescription] => stdClass Object
(
[@promo] => false
[ChargeableInfo] => stdClass Object
(
[@total] => 57.94
我建立一个像这样的报告..
foreach( $response->FlightInformation->Itinerary as $output) {
echo $output-> bookingID;
echo $output-> creationDate;
echo $output-> arrivalDate; <<<< won't Print
echo $output->departureDate; <<<< won't Print
echo $output->total; <<<< won't Print
以及更多元素……但是在行程数组内的对象下的任何内容都不会显示……我无法打印指示的这些值,请帮助……</p>
干杯