[LayaAir 2.0]ts如何获取客户端IP地址
如何获取客户端IP地址,最好是用Ts脚本就可以实现,js也可以。
// 获取IP地址
wx.request({
url: 'https://tianqiapi.com/ip/',
data: {
},
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded'
},
success: function (res) {
console.log('IP地址: ' + res.data.ip);
Test222.IP = res.data.ip;
}
});
wx.request({
url: 'https://tianqiapi.com/ip/',
data: {
},
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded'
},
success: function (res) {
console.log('IP地址: ' + res.data.ip);
Test222.IP = res.data.ip;
}
});
解决了
要回复问题请先登录