0
에서 JSON 파일에 액세스 :은 내가 JSON의이 같은 파일이 PHP
"location" : {
"lat" : 48.0418838,
"lng" : 14.4078882
},
: 나는 정의되지 않은 인덱스 위치를 얻을 액세스하려고
{"results" : [
{
"address_components" : [
{
"long_name" : "4400",
"short_name" : "4400",
"types" : [ "postal_code" ]
},
{
"long_name" : "Upper Austria",
"short_name" : "OÖ",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "Austria",
"short_name" : "AT",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "4400, Austria",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 48.06669549999999,
"lng" : 14.4687485
},
"southwest" : {
"lat" : 47.9987654,
"lng" : 14.3408425
}
},
"location" : {
"lat" : 48.0418838,
"lng" : 14.4078882
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 48.06669549999999,
"lng" : 14.4687485
},
"southwest" : {
"lat" : 47.9987654,
"lng" : 14.3408425
}
}
},
"types" : [ "postal_code" ]
}
],
"status" : "OK"
}
과 매번, 나는이 부분에 액세스하려면
with this :
$url1="http://maps.googleapis.com/maps/api/geocode/json?address=AT-".$a."&sensor=false";
$unparsed_json = file_get_contents($url1);
$data =(array) json_decode($unparsed_json);
echo $unparsed_json;
$latlng= $data['results']['location']['lat'];
echo $latlng;
하지만 결과는 null입니다. 어떤 도움이라도 대단히 감사 할 것입니다.
위대한, 나를 구해줬습니다. – enigmaticus
@juliesmith는 그 당시의 대답을 표시했습니다. 그렇지 않으면 미래에 귀하의 질문에 대한 답변의 동기가 줄어들 것입니다. – Avery
나는 그것을 알고있다. 그러나 내가 그것을 받아들이 기 전에 당신이 기다릴 필요가 있기 때문에 나는 그것을 즉시 할 수 없었다. :) – enigmaticus