【问题标题】:Axios, api ,laravel get :get method is working.. but for post method cors errorAxios,api,laravel get :get 方法正在工作..但是对于 post 方法 cors 错误
【发布时间】:2018-04-24 10:29:14
【问题描述】:

使用 axios。我的 get 方法有效,但 post 方法显示 cors 错误。并在 chome->networs->header

中获得不同的标头响应
axios.get('http://127.0.0.1:8000/api/login', {
            params : {

                username:username,
                password:password,
            }
            })
            .then(function(response) {
                console.log(response)
            })
            .catch(function(error) {
                console.log(error)
            })

获取的标题响应

 Access-Control-Allow-Origin    *
  Access-Control-Allow-Methods POST, GET, OPTIONS, PUT, DELETE
   Access-Control-Allow-Headers 
   Content-Type, X-Auth-Token, Origin

帖子的标题响应

    Allow       POST
     Access-Control-Request-Method      POST
    Access-Control-Request-Headers      content-type

请帮帮我.....

【问题讨论】:

    标签: php api axios laravel-5.5


    【解决方案1】:

    我会遇到同样的问题

    我尝试this url 并解决我的问题

    请试试这个....

    【讨论】:

      猜你喜欢
      • 2016-09-04
      • 2020-08-01
      • 2013-06-07
      • 1970-01-01
      • 2017-10-05
      • 1970-01-01
      • 1970-01-01
      • 2019-01-23
      • 1970-01-01
      相关资源
      最近更新 更多