/**
* 获取2点之间的距离
* $lat1经度 ---ios、安卓-传值
* $lng1纬度 ---ios、安卓-传值
* $lat2经度 ---数据中的
* $lng2纬度 ---数据中的
* 调用--$this->getDistance($lat1, $lng1, $lat2, $lng2)
*/
public function getDistance($lat1, $lng1, $lat2, $lng2)
{
$radLat1 = $lat1 * (PI / 180);
$radLat2 = $lat2 * (PI / 180);
$a = $radLat1 - $radLat2;
$b = ($lng1 * (PI / 180)) - ($lng2 * (PI / 180));
$s = 2 * asin(sqrt(pow(sin($a/2),2) + cos($radLat1)*cos($radLat2)*pow(sin($b/2),2)));
$s = $s * EARTH_RADIUS;
$s = round($s * 10000) / 10000;
$s = round($s, 2).'km';
return $s;
}