48

我的 CRON 作业返回了 CRON 作业不起作用的错误。在那里:

Set-Cookie: PHPSESSID=2t2drultihqci4em15nbfmeb63; path=/
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
Content-type: text/html

我想知道为什么Expires设置为“1981”。有什么意义?

4

4 回答 4

106

这是尝试禁用缓存。

该日期是添加代码的开发人员Sascha Schumann的生日。

来自 session.c:

Authors: Sascha Schumann <sascha@schumann.cx> 
         Andrei Zmievski <andrei@php.net> 

// ...

CACHE_LIMITER_FUNC(private)
{
    ADD_HEADER("Expires: Thu, 19 Nov 1981 08:52:00 GMT");
    CACHE_LIMITER(private_no_expire)(TSRMLS_C);
}
于 2011-11-19T13:55:39.800 回答
8

HTTP 过期标头

http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html

它设置为负值或过去值,以防止响应缓存。

这个头的很常见的用法。

于 2011-11-19T13:54:38.450 回答
7

I think you are using session_cache_limiter before calling session_start. If argument is private or no-cache the result is setting the Expires header to the time you have mentioned. Refer to this document for more information.

于 2011-11-19T14:06:34.803 回答
0

有人只是expires = date('-30 years')在他的代码中放入(解释)以确保内容设置为过期且未缓存。

于 2011-11-19T13:55:29.073 回答