请求openid出现错误 error: "wx is not defined"
大家帮我看看我错在哪了,真不会了!
wx.request({
url: ‘https://api.weixin.qq.com/sns/jscode2session?appid=’ + appid + ‘&secret=’ + secret + ‘&js_code=’ + ctx.request.body.code + ‘&grant_type=authorization_code’,
data: {
code: ctx.request.body.code
},
method: ‘GET’,
success: function(res) {
ctx.response.body = res.openid
},
fail(res) {
},
complete() {
}
});
大家帮我看看我错在哪了,真不会了!