小程序发送网络请求400报错解决办法

小程序发送网络请求400报错解决办法

在使用小程序时遇到请求时400

代码块

例如:

wx.request({
  url: 'test.php', //仅为示例,并非真实的接口地址
  data: {
     x: '' ,
     y: ''
  },
  header: {
      'content-type': 'application/json'
  },
  success: function(res) {
    console.log(res.data)
  }
})

注意:小程序在更新最新版本后header新写法


  header: {
      'content-type': 'json'
  }

猜你喜欢

转载自blog.csdn.net/wwj791859814/article/details/70243680