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: *');

你可能感兴趣的:(php跨域请求)