处理跨域Options预检请求
作者:互联网
//处理Options预检请求
if($_SERVER['REQUEST_METHOD'] == 'OPTIONS'){
//允许的源域名
header("Access-Control-Allow-Origin: *");
//允许的请求头信息
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization");
//允许的请求类型
header('Access-Control-Allow-Methods: GET, POST, PUT,DELETE,OPTIONS,PATCH');
exit;
}
标签:Control,跨域,预检,OPTIONS,Access,header,Allow,Options,请求 来源: https://www.cnblogs.com/goodgongdstudy/p/15341968.html