laravel里面使用 axios请求外网json报错,怎么设置请求头
XMLHttpRequest cannot load http://api.laifudao.com/open/xiaohua.json. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.
1 Comment
添加这个请求头:
Access-Control-Allow-Origin
就好了 值可以设置为*