微信小程序生成二维码
先请求得到access_token
wx.request({
url: "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="1234"&secret="123",
method: 'POST',
header: {
"Content-Type": "application/json"
//'content-type': 'application/x-www-form-urlencoded'
},
success: function (res) {
console.log(res.data.access_token)
that.setData({
access_token: res.data.access_token,
})
fail: function (error) {
console.log(error)
}
})
请求url后面的参数值
获取二维码
wx.request({
url: "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + res.data.access_token,
method: 'POS