我试图在这个嵌套的stdClass对象中打印值,但是我无法访问它们。例如,我如何打印“originCity”的值?
stdClass Object (
[FlightInfoResult] => stdClass Object (
[next_offset] => 1
[flights] => stdClass Object (
[ident] => SWA2558
[aircrafttype] => B737
[filed_ete] => 00:50:00
[filed_time] => 1362879561
[filed_departuretime] => 1362880080
[filed_airspeed_kts] => 442
[filed_airspeed_mach] =>
[filed_altitude] => 410
[route] => LBY MEI J31 VUZ
[actualdeparturetime] => 1362880080
[estimatedarrivaltime] => 1362882900
[actualarrivaltime] => 1362882600
[diverted] => [origin] => KMSY
[destination] => KBHM
[originName] => New Orleans Intl
[originCity] => New Orleans, LA
[destinationName] => Birmingham-Shuttlesworth Intl
[destinationCity] => Birmingham, AL
)
)
)
答案 0 :(得分:4)
尝试
$var->FlightInfoResult->flights->originCity
答案 1 :(得分:2)
你可以使用
$object->FlightInfoResult->flights->originCity;
访问对象属性。
抱歉。