我正在使用此代码进行附近的搜索,我有问题,如何获得结果?
results = 0然后,我想检查radius = 1到1000,results = 1然后我想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");