在微信开发者工具中index.js中的page中输入下列代码
onLoad:function(options) {
console .log('onLoad()监听页面加载')
wx.request({
url: 'http://localhost/app/LKT/index.php?module=AdminLogin&type=1',
data:{typ:2},
success:(res)=>{
console.log('请求成功',res);
},
fail:(err)=>{
console.log('请求失败',err);
}
})
},
通过wx.request方法请求在第一节所搭建网站
在微信小程序开发者申请合法域名(URL需要https协议)
关闭域名合法性校检