时间:2021-07-01 10:21:17 帮助过:7人阅读
|
如何使用 Google Maps API 获得某一特定地点的经度和纬度呢?本文为大家提供一个函数,它以某一地址作为参数,返回一个数组,包含经度和纬度数据。有需要的朋友,可以参考下。
代码如下:
1 || strpos($_result,'Did you mean:') !== false) return false;
preg_match('!center:\s*{lat:\s*(-?\d+\.\d+),lng:\s*(-?\d+\.\d+)}!U', $_result, $_match);
$_coords['lat'] = $_match[1];
$_coords['long'] = $_match[2];
}
return $_coords;
}
?> |