微信小程序生成二维码
先请求得到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

本文介绍了微信小程序生成二维码的步骤,包括先获取access_token,然后请求生成二维码,并确保发布时将相关路径加入白名单。提供了请求代码示例以及在WXML中的使用方法。
最低0.47元/天 解锁文章
678

被折叠的 条评论
为什么被折叠?



