网上各种搜索,各种置换参数,皆不行,原来是自带的微信开发工具的bug:
红框处一定要勾选,否则有些请求会失败!!!
附post请求源码:
wx.request({
url: "http://client",
header: {
"Content-Type": "application/x-www-form-urlencoded"
},
method: 'POST',
data: { ac: "getVerifyImage" },
success: function (res) {
console.log("请求成功!");
if (res.data.msg === 0) {
wx.showToast({
title: '请求成功',
icon: 'success',
mask: true,
})
} else {
}
},
fail: function (error) {
console.log("请求失败!");
}
});
以上.