var getLocation = document.getElementById('getLocation');
getLocation.onclick = function(){
//使用getLocation接口获取地理位置坐标
wx.getLocation({
success:function(res){
var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
var speed = res.speed; // 速度,以米/每秒计
var accuracy = res.accuracy; // 位置精度
alert(JSON.stringify(res));
},
cancel:function(res){
alert('用户拒绝授权获取地理位置');
},
});
};
Php访问对应的URL,获取返回的内容,然后自己再解析处理
//$url = urlencode("http://xyz.com/api?apikey=foo&v1=bar&v2=baz");
$url = "http://xyz.com/api?apikey=foo&v1=bar&v2=baz";
$response = file_get_contents($url);