微信小程序-关于post 过来服务器没有获取到数据问题

时间:2016-12-01 12:04:52   收藏:0   阅读:411

查看一下服务器接收的post 参数是以什么形式接收的 

 微信给出得demo 请求的方式是Json 参数传递的

  所以如果服务器使用的from 表单形式接收数据需要更改微信小程序中的 header

  将

  

    header: {
        ‘content-type‘: ‘application/json‘
    },
  

  改成

  

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

  

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