//设置utf8
header("Content-Type: text/html; charset=UTF-8");
// 指定允许其他域名访问
header('Access-Control-Allow-Origin:*');
// 响应类型
header('Access-Control-Allow-Methods:POST');
// 响应头设置
header('Access-Control-Allow-Headers:x-requested-with,content-type');
本文详细介绍了如何通过设置HTTP头部实现跨域资源共享(CORS),包括允许其他域名访问、指定响应类型及设置响应头等关键步骤。
//设置utf8
header("Content-Type: text/html; charset=UTF-8");
// 指定允许其他域名访问
header('Access-Control-Allow-Origin:*');
// 响应类型
header('Access-Control-Allow-Methods:POST');
// 响应头设置
header('Access-Control-Allow-Headers:x-requested-with,content-type');
转载于:https://www.cnblogs.com/yangchong/p/6362354.html
469
473
506

被折叠的 条评论
为什么被折叠?