我有错误是什么问题?我怎么得到echo getAddress?我试过时间来解决这个问题吗?
function getAddress($la, $lo){
$ur= "http://maps.googleapis.com/maps/api/place/nearbysearch/json?location=".$la.",".$lo."&radius=10&sensor=true&key=AIzaSyA0JD_Z2Uo2AfnDTejQFWHAXOIaRRpjF8c"
$json = file_get_contents($ur);
$data = json_decode($json);
$status = $data->status;
$name= '';
if($status == "OK"){
$addr = $data->results[0]->formatted_address;
}
return $addr;
}
echo getAddress("6.154841","80.700845");
答案 0 :(得分:0)
您忘记了$ur
$ur= "http://maps.googleapis.com/maps/api/place/nearbysearch/json?
location=".$la.",".$lo."&radius=10&sensor=true&key=AIzaSyA0JD_Z2Uo2AfnDTejQFWHAXOIaRRpjF8c";