post请求后台接收不到数据?

小程序 文章 2022-02-22 17:00 782 0 全屏看文

AI助手支持GPT4.0

post请求后台接收不到数据?Post request background can not receive data?

post请求后台接收不到数据?

 wx.request({

          url: url

          method: 'POST',

          header: { 

              "Content-Type": "application/x-www-form-urlencoded",  

              "Authorization":  getApp().globalData.session

            }, 

          data: data,

          dataType: 'json',

          success: res=>{

              console.log(data)

              console.log(res)

          }

后台接收不到数据,为什么啊

wx.request({ url: url method: 'POST', header: { "Content-Type": "application/x-www-form-urlencoded", "Authorization": getApp().globalData.session }, data: data, dataType: 'json', success: res=>{ console.log(data) console.log(res) } 后台接收不到数据,为什么啊

回答:

Sprite:

试试把data拼接到url上,例如https://xxx.com?id=1


Mr.Zhao:

代码一写就对?

圣殿骑士:

看下这个有值吗? console 里面打印报错吗? 看下请求是什么情况,200还是404?

-EOF-

AI助手支持GPT4.0