header("Access-Control-Allow-Origin=");//许可全部域名访问

或者

header("Access-Control-Allow-Origin:www.baidu.com")//限定一个域名访问

php跨域PHP解决跨域问题 HTML

header("Access-Control-Allow-Methods:POST");//限定POST要求

header("Access-Control-Allow-Headers:x-requested-with,content-type");

第二种办法:在NGINX内配置

add_header Access-Control-Allow-Origin ;

add_header Access-Control-Allow-Credentials true;

add_header Access-Control-Allow-Headers "x-requested-with,Authorization";

add_header Access-Control-Allow-Methods ;