header('Access-Control-Allow-Origin : *');
header('Access-Control-Allow-Headers : Origin, X-Requested-With, Content-Type, Accept');
header('Access-Control-Allow-Methods :PUT,POST,GET,DELETE,OPTIONS');
//持久化session
header("Access-Control-Allow-Credentials : true");
//客户端:
xhrFields: {
withCredentials: true
}
转载自原文链接, 如需删除请联系管理员。
原文链接:Ajax跨域请求PHP header设置,转载请注明来源!