前端 請求 是這樣寫的 但是有問題 不知道哪裡不對
wx.request({
url: 'http://localhost/index.php',
method: "POST",
data: {
total_fee: total_fee,
code: code,
},
header: {
'content-type': 'application/x-www-form-urlencoded' // 預設值
},
success: function (res) { //後端回傳的數據
var data = res.data;
console.log(data);
console.log(data["timeStamp"]);
wx.requestPayment({
timeStamp: data['timeStamp'],
nonceStr: data['nonceStr'],
package: data['package'],
signType: data['signType'],
paySign: data['paySign'],
success: function (res) {
wx.showModal({
title: '支付成功',
content: '',
})
},
fail: function (res) {
console.log(res);
}
})
}
});