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: *');
浙公网安备 33010602011771号