TP5.x——开启跨域访问

其实很简单,在入口文件的index.php添加几句header就可以了.

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

 

posted @ 2019-06-15 16:32  1O(∩_∩)O1  阅读(1348)  评论(0编辑  收藏  举报