/**
* 根据HTTP请求获取用户位置
*/
function getUserLocation()
{
$key = "16199cf2aca1fb54d0db495a3140b8cb"; // 高德地图key
$url = "http://restapi.amap.com/v3/ip?key=$key";
$json = file_get_contents($url);
$obj = json_decode($json, true); // 转换数组
$obj["message"] = $obj["status"] == 0 ? "失败" : "成功";
return $obj;
}