Vue 跨域问题解决办法2020

<?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');
}

猜你喜欢

转载自www.cnblogs.com/vip-deng-vip/p/12461547.html