微信小程序获取用户IP地址,HTTPS接口
  • 首页
  • 写文档
  • 主页
  • 登录/注册

很简单实用的ip地址接口, 只返回当前ip

接口返回内容格式为:
{“ip”:“27.211.239.98”}

// 获取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);
  }
});

温馨提醒
如果是测试, 请勾选配置 不校验合法域名、web-view(业务域名)、TLS 版本以及 HTTPS 证书
如果正式使用, 请添加安全域名 ( tianqiapi.com )

    • 阅读量
    • 发布日期(默)
    • 排序:

    • 文档
    • 粉丝
    • 评论
    • 点赞
    • 访客
    个人分类
    评论区 写评论
    ↑ 收起 ↑ 提 交