2010-09-29 117 views
0

我有我的緩存相關的頭設置中的8小時到期如下...我的Pragma HTTP響應頭文件應該設置爲?

header('Cache-Control: max-age=28800'); 
header('Expires:' . gmdate('D, d M Y H:i:s T', strtotime('+8 hours'))); 

有了這樣的情況下,我應該我的語用HTTP響應頭被設置爲?

回答

2

您不必設置雜注,僅當您需要no-cache指令時才設置雜注。在此處查看更多信息:http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.32

+1

我的服務器自動將Pragma設置爲no-cache(我無權修改)。所以我想將附註值更改爲與上面概述的緩存設置更一致的內容,或者通過我的PHP腳本以某種方式將整個編譯指示字段清空。有任何想法嗎? – Drew2345 2010-09-29 14:19:46

+1

如果它是apache,它將.htaccess考慮在內,並有頭文件模塊,你可以使用這個指令「頭文件unset Pragma」 – hellvinz 2010-09-29 14:30:38

+0

我不認爲mod_headers.c被激活。 – Drew2345 2010-09-29 14:44:12

1

請參閱PHP文檔session_cache_limiter。您將看到正確的緩存頭派:

市民:

Expires: (sometime in the future, according session.cache_expire) 
Cache-Control: public, max-age=(sometime in the future, according to session.cache_expire) 
Last-Modified: (the timestamp of when the session was last saved) 

private_no_expire:

Cache-Control: private, max-age=(session.cache_expire in the future), pre-check=(session.cache_expire in the future) 
Last-Modified: (the timestamp of when the session was last saved) 

私人:

Expires: Thu, 19 Nov 1981 08:52:00 GMT 
Cache-Control: private, max-age=(session.cache_expire in the future), pre-check=(session.cache_expire in the future) 
Last-Modified: (the timestamp of when the session was last saved) 

非緩存:

Expires: Thu, 19 Nov 1981 08:52:00 GMT 
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 
Pragma: no-cache