我可能錯過了一些明顯的東西,但是我的Codeigniter應用程序在我提出要求時未發送標題。 所以在任何控制器或擴展MY_Controller:發送緩存控制標題在Codeigniter中不起作用
$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
所以我知道它發送從史蒂夫頭:頭,但它不是送我的Cache-Control設置。如果我註釋掉Cache-Control設置,它仍然顯示相同的值。
在哪裏可以被覆蓋?它是Codeigniter,PHP還是Apache?
確定的歡呼聲,我會檢查出來多一點徹底。 – Stevo 2012-03-20 16:39:05