Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试从服务器访问文件:
$.get('http://server.com/methods.php?m=loadSomething', function(data) { console.log(data); });
但我得到错误:
Origin http://localhost:58888 is not allowed by Access-Control-Allow-Origin.
有什么方法可以更改访问控制设置,以便我可以访问远程服务器并获取数据?
谢谢。
在里面methods.php只使用header()类似的方法
methods.php
header()
header('Access-Control-Allow-Origin: http://localhost:58888')