直接上代码
在后台写 允许跨域的域名,
$allowedDomains = array("https://example1.com", "https://example2.com");
$origin = isset($_SERVER['HTTP_ORIGIN']) ? $_SERVER['HTTP_ORIGIN'] : '';
if (in_array($origin, $allowedDomains)) {
header("Access-Control-Allow-Origin: " . $origin);
} else {
header("HTTP/1.1 403 Forbidden");
die("Access denied");
}
标签:origin,HTTP,跨域,偶遇,Access,header,解决,array
From: https://www.cnblogs.com/79524795-Tian/p/17797389.html