网站首页 博客 PHP允许跨域请求header
程序中添加以下代码
$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"); }