再axios种传入

application/x-www-form-urlencoded
这样格式的参数,需要如下写法:
     axios({
        url: `你的url`,
        method: 'POST',
        // withCredentials: true,//如果需要cookie要加这个
        // credentials: 'include',//这个据说也事包含cookie的方法,待验证
        data: params,
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded',//类型设置
          // 'cookie': 'SESSION=YWFiNThjMjEtMjI2OC00YjZhLWFkZTMtYTcxYWVmZjhjMjdj; 你的参数=你的值',//指定的cookie的话可以试试这种写法
        },
      }).then(ret => {
        console.log(ret)
      })

其中param不要

FormData方式,也不要json的格式,要这么写:
`name=zs&age=18&sex=female`
不然会出现contenttype错误或者后台收到的数据格式不对等情况,
另外注意跨域问题

相关文章:

  • 2021-05-26
  • 2022-12-23
  • 2021-11-30
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-07
  • 2021-07-03
相关资源
相似解决方案