method: 'POST' 服务器取不到值!!!

发布于 8 年前作者 nxu19915 次浏览最后编辑 8 年前来自 ask

GET的时候正常, method: ‘POST’ 服务器取不到值,除了大写,还要注意什么

4 回复
chou
chou1 楼6 年前

还要加header,下面代码测试通过,可以直接用

wx.request({

      url:‘https://XXXX.com/xxxx’,

      header: {  

        “content-type”: “application/x-www-form-urlencoded”  

      },  

      method:‘POST’,

      data:{

        mydata:“12323213231213”,

      },

      success: function(res) {

//处理回调

     }

})

guping
guping2 楼6 年前

可以了,谢谢啦。

guiyingxiong
guiyingxiong3 楼6 年前

可以分享下吗 楼主

mayong
mayong4 楼6 年前

用这个吧 $raw_post_data = file_get_contents(‘php://input’);