距离我最近的鲜花店 (距离我最近的农业银行在哪里)
上海桑拿
05-13
阅读:63
评论:0
![](/gg/hf11.gif)
![距离我最近的鲜花店 (距离我最近的农业银行在哪里)](https://all-brilliant.com/thumb/20240513140904_44374.jpg)
-
lat;$lon = $data->lon;$radius = 5000; // 搜索半径为5公里$query = 'flower shop';$key = 'YOUR_GOOGLE_MAPS_API_KEY'; // 替换为您的Google Maps API密钥$url = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=$lat,$lon&radius=$radius&query=$query&key=$key";$response = file_get_contents($url);$data = json_decode($response);// 遍历最近的鲜花店,显示名称、地址和距离foreach ($data->results as $result) {$name = $result->name;$address = $result->vicinity;$distance = $result->distance / 1000; // 距离单位转换为公里echo "
-
$name
$address
$distance 公里
";}?>
版权声明
本文仅代表作者观点,不代表上海桑拿立场。
本文系作者授权发表,未经许可,不得转载。