目录

后端收不到微信小程序wx.request的传值问题-php

目录

后端收不到微信小程序wx.request的传值问题 php

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

})

刚开始前端同事把header注释了传值,结果我后端收不到任何参数打印post是空,在网上找的是设置

header: {
      'content-type': 'application/x-www-form-urlencoded'
  },
就收到了