Vue 跨域问题解决办法2020LinUI林间有风

 

<?php
(我一般放到入口文件里index.php)
//  设置请求头
setHeader();


function setHeader()
{
// 公共响应头
header('Content-Type: Application/json');

// 如果需要跨域,写在这里
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-Requested-With');
header('Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE');
}

 

posted @ 2020-03-11 12:22  林间有风-邓  阅读(496)  评论(0编辑  收藏  举报