PHP session_start() 覆盖 HTTP Expires 标头

2022-01-17 00:00:00 http-headers session php mod-expires

我正在尝试使用 mod_expires 将 Expire 标头设置为从访问 text/html 后 2 小时:

I am trying to set Expire header to 2 hours from access for text/html by using mod_expires like that:

<IfModule mod_expires.c>
   ExpiresActive on
   ExpiresDefault "access plus 2 hours"
   ExpiresByType text/html "access plus 2 hours"
</IfModule>

但是当与 PHP 一起使用时:

However when used with PHP:

session_start();

Expires 标头正在重置为:

Expires header is being reset to:

Expires: Thu, 19 Nov 1981 08:52:00 GMT

任何想法如何避免 session_start() 覆盖?

Any ideas how to avoid that overwrite by session_start()?

推荐答案

好的,貌似找到答案了:

OK, looks like have found an answer:

session_cache_limiter('public');
session_start();

成功了,谢谢.

相关文章