ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
/** 查找两个经纬度之间的距离 @param $latitude1 float 起始纬度 @param $longitude1 float 起始经度 @param $latitude2 float 目标纬度 @param $longitude2 float 目标经度 @return array(miles=>英里,feet=>英尺,yards=>码,kilometers=>公里,meters=>米) @example **/ function getDistanceBetweenPointsNew($latitude1, $longitude1, $latitude2, $longitude2) { $theta = $longitude1 - $longitude2; $miles = (sin(deg2rad($latitude1)) * sin(deg2rad($latitude2))) + (cos(deg2rad($latitude1)) * cos(deg2rad($latitude2)) * cos(deg2rad($theta))); $miles = acos($miles); $miles = rad2deg($miles); $miles = $miles * 60 * 1.1515; $feet = $miles * 5280; $yards = $feet / 3; $kilometers = $miles * 1.609344; $meters = $kilometers * 1000; return compact('miles', 'feet', 'yards', 'kilometers', 'meters'); }