//app.js App({ onLaunch: function () { console.log('1' ) wx.login({ success: function (res) { console.log(res.code) //这就是code if (res.code) { //发起网络请求 wx.request({ url: 'https://zjite.applinzi.com/api/openid.php', header:{ 'content-type':'application/json' }, data: { code: res.code }, success:function(res){ console.log(res); console.log(res.data); console.log(res.data.openid); } }) console.log('2') } else { console.log('获取用户登录态失败!' + res.errMsg) } } }); } })