tp5 跨域问题

只需要三行代码,写到入口文件public/index.php处即可解决

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");

如图:

猜你喜欢

转载自www.cnblogs.com/junyi-bk/p/11390251.html