前几天写了一个接口发现不能返回json,问了一下原来是没有设置跨域请求
设置php跨域请求代码:

 header("Access-Control-Allow-Origin: *");
 header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization");
 header('Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS,PATCH');
Last modification:November 16th, 2019 at 01:23 pm
如果觉得我的文章对你有用,请随意赞赏