开发者

PHP using session_cache_limiter() and session_cache_expire() or multiple header()

开发者 https://www.devze.com 2022-12-16 18:22 出处:网络
I want my PHP pages to be cached. To allow cache I use: session_cache_limiter(\'private\'); session_cache_expire(180);

I want my PHP pages to be cached. To allow cache I use:

session_cache_limiter('private');
session_cache_expire(180);
session_start();

Since I'm only using sessions for these cache headers, should I just drop these 3 line and replace them with (I'm never using $_SESSION):

header('Expires:开发者_JS百科 <some GMT date>');
header('Cache-Control: private, max-age=<some GMT date in the future>, pre-check=<some GMT date in the future>');
header('Last-Modified: <some GMT date>');


Yes, if your only reason for using sessions is strictly only for sending headers then use header()

0

精彩评论

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