JSON谷歌地图数组



请问我在数组中导航时做错了什么?我需要使用 php 和 json 响应来获得纬度。提前谢谢你。

$googleurl='https://maps.googleapis.com/maps/api/geocode/json?address=Prague';
$json=file_get_contents($googleurl);
$res=json_encode($json, true);
print $res['results'][0]['geometry']['location']['lat'];

您需要解码 json 而不是编码。

尝试使用,

$res=json_decode($json, true);

最新更新