$slat = $banner_content['jd'];
$slng = $banner_content['wd'];
$sql = "select *, acos(
sin(($slng*3.1415)/180) * sin((wd*3.1415)/180) +
cos(($slng*3.1415)/180) * cos((wd*3.1415)/180) * cos(($slat*3.1415)/180 - (jd*3.1415)/180)
)*6370.996 AS juli FROM {$this->model->pre}post where status=1 and cid=29 HAVING juli <= 1";
$list = $this->model->query($sql);
数据库字段 jd 经度 wd 纬度
某点的坐标
$slat 经度
$slng 纬度
更多精彩文章请关注 王明昌博客