Blogger Information
Blog 175
fans 1
comment 0
visits 384385
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
uniapp 开发中,uni.request函数post请求,服务端接收不到数据原因
dxp2tq的博客
Original
2997 people have browsed it

uni.request,post模式,后台api总是获取不到参数,很有意思,我调试了一个小时才发现原因。
其实是因为https和http的原因,我的服务端强制HTTPS,所以将http改为https即可。

uni.request({
“url”: “https://***/User/sendSms“,
“data”: {
“mobile”: “188**1234”
},
“method”: “POST”,
“header”: {
“Content-Type”: “application/x-www-form-urlencoded”
},
“dataType”: “JSON”
success: (res) => {
console.log(res.data);
}
});

希望能帮助到需要的小伙伴。

phpstorm激活遇到问题的小伙伴可以私信我,永久激活。

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post