网站首页 博客 PHP允许跨域请求header
PHP允许跨域请求header
 2021-12-08 16:10:53  管理员  111

程序中添加以下代码

$origin = $_SERVER["HTTP_ORIGIN"];
$whitelist = array("http://xuexi.iefeel.com", "http://oa.iefeel.com", "http://yi.iefeel.com");
if(in_array($origin, $whitelist)){
	header("Access-Control-Allow-Origin: ". $origin);
	header("Access-Control-Allow-Method: *");
	header("Access-Control-Allow-Credentials: true");
}


来说两句吧
最新评论