今天在做接口对接时,VUE遇到一个跨域的问题就是用号不能使用,具体原因后面有空再查吧

##续上,今天查了下上面的问题(参与URL https://juejin.im/entry/584677e279bc440065c79cc2

Access-Control-Allow-Origin是支持,而在Access-Control-Allow-Headers部分却没有提到支持通配符。

所有正确写法 

style="max-width: 100%;">header("Access-Control-Allow-Origin: ");
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");



header('Access-Control-Allow-Origin: '*'); 

改为:

 header('Access-Control-Allow-Origin: '.$_SERVER['HTTP_ORIGIN']);

    header('Access-Control-Allow-Credentials: true');
    header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS');
    header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, authKey, sessionId");
   

##以上设置仅为测试环境机器,不建议生产环境,生产环境建议单独配置域名