PHP using session_cache_limiter() and session_cache_expire() or multiple header()
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()
精彩评论