tp5 MYSQL 查询两个经纬度之间的距离并由近及远排序
$ad = Db::connect('databasetwo')->query("SELECT *,(2 * 6378.137 * ASIN( SQRT(POW( SIN( PI( ) * ( " . 用户$longitude . "- 查询表.longitude ) / 360 ), 2 ) + COS( PI( ) * " . 用户$latitude . " / 180 ) * COS( 查询表.latitude * PI( ) / 180 ) * POW( SIN( PI( ) * ( " . 用户$latitude . "- 查询表.latitude ) / 360 ), 2 )))) AS distance FROM `查询表`
ORDER BY distance ASC LIMIT 1");