zoukankan      html  css  js  c++  java
  • 小程序开发二三事--数据请求head的设置

    wx.request(OBJECT)

    发起请求的方法有很多,默认为 GET,有效值:OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT;

    一般在项目开发中用得较多的就是GET 和 POST

    在发起请求时,header 要设置正确:

    get请求时为

    header:{
                "content-type":'application/json'
            },
    

    post请求时为:

     header:{
            "content-type":'application/x-www-form-urlencoded'
        }

    注意: POST时必须要设置
    "content-type":'application/x-www-form-urlencoded',否则,请求不成功!
  • 相关阅读:
    bzoj1257
    bzoj1833
    bzoj3505
    bzoj2226
    bzoj1263
    bzoj2429
    bzoj1854
    bzoj3555
    bzoj1877
    放两个模版
  • 原文地址:https://www.cnblogs.com/garfieldzhong/p/6755452.html
Copyright © 2011-2022 走看看