对于如何将以下输出分离为不同的变量,我感到困惑。下面是我正在处理的数组:
stdClass Object ( [FlightInfoExResult] => stdClass Object ( [next_offset] => 1 [flights] => stdClass Object ( [faFlightID] => UAL1-1489818347-airline-0169 [ident] => UAL1 [aircrafttype] => B789 [filed_ete] => 17:05:00 [filed_time] => 1489818347 [filed_departuretime] => 1490074200 [filed_airspeed_kts] => 430 [filed_airspeed_mach] => [filed_altitude] => 0 [route] => [actualdeparturetime] => 0 [estimatedarrivaltime] => 1490136300 [actualarrivaltime] => 0 [diverted] => [origin] => KSFO [destination] => WSSS [originName] => San Francisco Intl [originCity] => San Francisco, CA [destinationName] => Singapore Changi [destinationCity] => Singapore ) ) )我是通过FlightAware API系统输出的。下面是我用来输出上述内容的代码:
$params = array("ident" => "UAL1","howMany" => 1,"offset" => 0 );
$result = $client->FlightInfoEx($params);
print_r($result);下面是一个示例,说明我希望它如何分离对象:
UAL1,B789 ect.发布于 2017-03-19 01:19:11
首先,这不是一个正在使用的数组,而是一个对象。
要访问它的属性,请使用->语法,即
$flightInfoExResult = $result->FlightInfoExResult;然后,您可以使用
flightInfoExResult->next_offset;等等。
https://stackoverflow.com/questions/42881761
复制相似问题