PHP跨域

header('Content-Type: text/html;charset=utf-8');
header('Access-Control-Allow-Origin:*'); // *代表允许任何网址请求
header('Access-Control-Allow-Methods:POST,GET,OPTIONS,DELETE'); // 允许请求的类型
header('Access-Control-Allow-Credentials: true'); // 设置是否允许发送 cookies
header("access-control-allow-headers: Accept,Authorization,Cache-Control,loginClient,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With");
// 设置允许自定义请求头的字段

 

posted @ 2020-01-22 16:40  御世制人  阅读(48)  评论(0编辑  收藏  举报