【发布时间】:2012-05-01 20:13:12
【问题描述】:
这是我第一次使用 JSON,我显然遇到了一些问题,我只是非常不确定它是什么。
我已经查找了如何解析简单的 json,但我认为它可能会让我失望。
这就是我试图获得我的价值观的方式:
$getJSON = "http://maps.googleapis.com/maps/api/geocode/json?address=" . str_replace(" ", "", $_POST['postcode']) . "&sensor=false";
$contentJSON = file_get_contents($getJSON);
$Geocode_array = json_decode($contentJSON, true);
$lat = $Geocode_array[results][address_components][geometry][location][lat];
$lng = $Geocode_array[results][address_components][geometry][location][lng];
如果需要,我可以发布 json 代码。
【问题讨论】:
标签: php json parsing google-geocoder