php后端跨域设置
// 指定允许其他域名访问
header('Access-Control-Allow-Origin:http://abc.cn');
// 允许所有域名访问
header('Access-Control-Allow-Origin:*');
// 允许跨域响应类型
header('Access-Control-Allow-Methods:POST,GET,OPTIONS');
// 响应头设置,允许设置Authorization和lpy这两个http头
header('Access-Control-Allow-Headers:Authorization,lpy');
// ajax异步
header('Access-Control-Allow-Headers: X-Requested-With,X_Requested_With,X-PINGOTHER,Content-Type')
评论 (0)