小程序接口请求成功,得不到请求数据

时间:2019-08-29 16:20:20   收藏:0   阅读:188

小程序接口请求成功但是请求不到数据,解决办法:在wx.request({})的header中添加

‘content-type‘: ‘application/x-www-form-urlencoded‘,

主要代码如下:

 header: {
        ‘content-type‘: ‘application/x-www-form-urlencoded‘,//解决请求不到数据
        ‘cookie‘: wx.getStorageSync("sessionid")//读取sessionid,当作cookie传入后台将PHPSESSID做session_id使用
      },

  

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!