需要帮助使用PHP解码JSON输出


Need help decoding JSON output with PHP

以下是我正在处理的JSON输出示例:

http://maps.google.com/maps/api/geocode/json?components=postal_code:90210&sensor=false

以下是从该位置提取纬度值的尝试:

$postalLong = $jsonOutput>results[0]->formatted_address[0]->location[1]->lng;   

我试过几种变体,但都不起作用。如何将34.1030032值应用于该变量?

我想你已经不匹配了。试试这个-

$json->results[0]->geometry->location->lat;