php 后端跨域请求

1 header("Access-Control-Allow-Origin: http://a.com"); // 允许a.com发起的跨域请求  
2 //如果需要设置允许所有域名发起的跨域请求,可以使用通配符 *  
3 header("Access-Control-Allow-Origin: *"); // 允许任意域名发起的跨域请求  
4 header('Access-Control-Allow-Headers: X-Requested-With,X_Requested_With');  
原文地址:https://www.cnblogs.com/spirit-ling/p/7098431.html