這裏有您需要修改
PHP
function buildGeocode($address_1, $address_2, $city, $state, $zip_code, $country){
$base_url = "http://maps.googleapis.com/maps/api/geocode/json";
$address = $address_1 . ' ' . $address_2 . ', ' . $city . ' ' . $state . ' ' . $zip_code . ' ' . $country;
$request_url = $base_url . "?address=" . urlencode($address) . "&sensor=false";
$data = json_decode(file_get_contents($request_url), true);
return array('lat' => $data['results'][0]['geometry']['location']['lat'], 'lng' => $data['results'][0]['geometry']['location']['lng']);
}
MySQL的
兩圈腳本
"SELECT SQL_CALC_FOUND_ROWS
*
FROM (SELECT location_tbl.*, (3959*(2*ASIN(SQRT(POW(SIN(((location_tbl.lat-" . $lat . ")*(PI()/180))/2),2)+COS(location_tbl.lat*0.017453293)*COS(" . $lat . "*0.017453293)*POW(SIN(((location_tbl.lng-" . $lng . ")*(PI()/180))/2),2))))) AS distance
FROM location_tbl
WHERE location_tbl.active = 1 AND location_tbl.deleted = 0) AS tmp_tbl
WHERE distance <= '" . $dis . "'
ORDER BY distance ASC"
我是否因爲我在尋找方向而投了票?因爲我犯了一個愚蠢的錯誤,並預訂了一場演出,所以我沒有準備好?我喜歡一些反饋。 –