php accesscontrolalloworigin,php – Access-Control-Allow-Origin没有显示在codeigniter的响应头中...
我的Codeigniter文件說
$CI->output->set_header("Access-Control-Allow-Origin: *");
$CI->output->set_header("Access-Control-Expose-Headers: Access-Control-Allow-Origin");
$CI->output->set_status_header(200);
$CI->output->set_content_type('application/json');
echo json_encode(array("city" => "dhaka"));
但我得到的http響應(yīng)是:
Request URL:http://localhost/index.php/location/city
Request Method:POST
Status Code:200 OK
Connection:Keep-Alive
Content-Length:16
Content-Type:text/html
Date:Sun, 22 Jul 2012 10:27:32 GMT
Keep-Alive:timeout=5, max=100
Server:Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8r DAV/2 PHP/5.3.6
X-Powered-By:PHP/5.3.6
即使在包含Access-Control-Expose-Headers:Access-Control-Allow-Origin之后,響應(yīng)中也缺少標(biāo)題Access-Control-Allow-Origin.我有關(guān)此標(biāo)題的信息來源是Mozilla Developer Website
總結(jié)
以上是生活随笔為你收集整理的php accesscontrolalloworigin,php – Access-Control-Allow-Origin没有显示在codeigniter的响应头中...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: PHP类有哪几种,PHP中有哪几种常用类
- 下一篇: java str.split(quot;