开发者

PHP session_cache_limiter() private and nocache HTTP Expires date question

If 开发者_运维百科you look at the PHP doc help for function session_cache_limiter(), you will see that if the cache_limiter parameter is set to private or nocache the Expires HTTP header is set to a const date (Thu, 19 Nov 1981 08:52:00 GMT). I understand that this is a date in the past to avoid caching, but why this date/time in particular? It's not the 0 date, my guess is that this is some kind of easter egg. If it's some kind of dummy value in the past, can I change it for something else (still in the past) and still have the private/nocache mechanism still working?


it is the birthday of the person who contributed the code:

diffs: http://cvs.php.net/viewvc.cgi/php-src/ext/session/session.c?r1=1.80&r2=1.81

http://www.phpbuilder.com/lists/php3-list/199911/3159.php

to change it, it would be preferable to set the headers manually, for example nocache sets this:

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

but you could still do:

session_cache_limiter('nocache')
header('Expires: Thu, 1 Jan 2000 00:00:00 GMT');

header will replace any existing header with the same name (by default).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜