PHP session_start()会覆盖HTTP Expires标头 [英] PHP session_start() overwrites HTTP Expires header

查看:149
本文介绍了PHP session_start()会覆盖HTTP 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: 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();

诀窍,谢谢。

这篇关于PHP session_start()会覆盖HTTP Expires标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆