【发布时间】:2012-03-21 00:54:28
【问题描述】:
我可能遗漏了一些明显的东西,但是当我要求它时,我的 Codeigniter 应用程序没有发送标头。 所以在任何控制器或扩展的 MY_Controller 中:
$this->output->set_header("Last-Modified: " . gmdate( "D, j M Y H:i:s" ) . " GMT");
$this->output->set_header("Expires: " . gmdate( "D, j M Y H:i:s", time() ) . " GMT");
$this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate");
$this->output->set_header("Cache-Control: post-check=0, pre-check=0");
$this->output->set_header("Pragma: no-cache");
$this->output->set_header("Steve: it aint working you know");
我得到的标题是:
HTTP/1.1 200 OK
Date: Mon, 19 Mar 2012 18:03:06 GMT
Server: Apache/2.2.20 (Ubuntu)
X-Powered-By: PHP/5.3.6-13ubuntu3.6
Last-Modified: Mon, 19 Mar 2012 18:03:06 GMT
Expires: Sat, 01 Jan 2000 00:00:01 GMT
Cache-Control: post-check=0, pre-check=0, max-age=0
Pragma: no-cache
Steve: it aint working you know
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 10780
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html
所以我知道它正在从 Steve: 标头发送标头,但它没有发送我的 Cache-Control 设置。如果我注释掉 Cache-Control 设置,它仍然显示相同的值。
这可能在哪里被覆盖?是 Codeigniter、PHP 还是 Apache?
【问题讨论】:
标签: php http codeigniter