解决PHP跨域问题,JS,TP5

解决TP5跨域问题

在入口函数添加

header(“Access-Control-Allow-Origin:*”);
header(“Access-Control-Allow-Methods:GET, POST, OPTIONS, DELETE”);
header(“Access-Control-Allow-Headers:DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type, Accept-Language, Origin, Accept-Encoding”);

然后就OK了。

你可能感兴趣的:(ThinkPHP5.0)