查看app.log,$_POST['']空空如也。
https://ask.dcloud.net.cn/question/77082
加上 "Content-Type": "application/x-www-form-urlencoded"试试
复制代码uni.request({
url: 'https://www.example.com/request', //仅为示例,并非真实接口地址。
header: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data: {
name: 'name',
age: 18
},
method: 'POST',
success: function(res) {
console.log(res.data);
}
莫名其妙。我用的application/json。
但是改了就对了。