static function convert_gps($latx, $lngy) { //PtApp::$setting['qq_map']['key_service'] $key = Model_Setting::get("qq_map_key_service1"); if (!$key) { Model_Setting::add("qq_map_key_service1", "I6OBZ-EFNHR-JAZWY-WHLXW-O3TOH-EIFLA", "QQ地图 SERVICE KEY"); Model_Setting::add("qq_map_key_js", "66DBZ-IG7WJ-G2CFQ-KVS4Z-PBQA5-WQFLR", "QQ地图 JS KEY"); } $url = "http://apis.map.qq.com/ws/coord/v1/translate"; $data = array("locations" => $latx . "," . $lngy, "type" => 1, "key" => $key); $curl = new Curl(); $url = $url . "?" . http_build_query($data); $res = $curl->get($url); $body = json_decode($res['body']); if ($body->status > 0) { throw new Exception($body->message); } return $body->locations[0]; }