6***@qq.com
6***@qq.com
  • 发布:2024-06-28 11:23
  • 更新:2024-06-28 12:09
  • 阅读:31

uni post请求 传值没有传入服务器是怎么回事

分类:uni-app

uni.request({
url: getApp().globalData.url + 'Login/Index',
method: 'POST',
data: {
username: 'gyjczx',
password: 'Jczx123654'
},
success: (res) => {
console.log('登录返回值')
console.log(res);
console.log('登录返回值')

                }  
            });  

用apifox和其他接口测试工具提交是可以返回值 a

2024-06-28 11:23 负责人:无 分享
已邀请:
7***@qq.com

7***@qq.com

你打印看看url对不对先

  • 6***@qq.com (作者)

    url是一样的

    2024-06-28 11:29

6***@qq.com

6***@qq.com (作者)

找到答案了:是header里得设置成
对于 POST 方法且 header['content-type'] 为 application/x-www-form-urlencoded 的数据,会将数据转换为 query string。

要回复问题请先登录注册