php跨域请求

出现Access to XMLHttpRequest at 'http://www.tc.com/index.php/tc' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.错误

CORS策略已阻止从源位置“null”访问“http://www.tc.com/index.php/tc”处的XMLHttpRequest:请求的资源上不存在“Access Control Allow origin”头。

 

需要在自己请求的方法前面添加

header('Access-Control-Allow-Origin: *');

posted on 2019-12-25 16:57  初一九点半  阅读(330)  评论(0)    收藏  举报

导航