我试图在WordPress中启用CORS。我发现了很多文档。但没有什么对我有用。总是得到同样的错误。
XMLHttpRequest cannot load
The 'Access-Control-Allow-Origin' header contains the invalid value ''. Origin 'file://' is therefore not allowed access.
尝试将代码放在.htaccess和wordpress中的header.php文件中。
在http://client.cors-api.appspot.com/中测试网址,这就是我得到的。
Fired XHR event: loadstart
Fired XHR event: readystatechange
Fired XHR event: progress
Fired XHR event: error
XHR status: 0
XHR status text:
Fired XHR event: loadend
我真的迷失了,我尝试着,但没有任何作用。