这个在微信官方文档 小程序中有的,本人用了其中一个;因为在使用的途中出现的中文乱码的情况,所以记录一下
首先获取 access_token
用此接口:
GET https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET
官方文档中有的,大家可以去看一下:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/access-token/auth.getAccessToken.html
onLoad: function (options) {
wx.request({
url: 'https://api.weixin.qq.com/cgi-bin/token',
data: {
grant_type: 'client_credential',
appid: '微信小程序的APPID',
secret: '微信小程序的AppSecret'
},
header: { 'Content-Type': 'application/json' },