PHP根据两点间的经纬度计算距离
这是一个不错的示例,直接贴代码,首先要知道纬度值、经度值 / Convert these degrees to radians to work with the formula / $lat1 = ($lat1 pi() ) / 180; $lat2 = ($lat2 pi() ) / 180; /* http://en.wikipedia.org/wiki/Haversine_formula calculate the distance $calcLongitude = $lng2 - $lng1; return round($calculatedDistance); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |