AlexV
AlexV

Reputation: 23108

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: <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>');

Upvotes: 2

Views: 1585

Answers (1)

Anthony Forloney
Anthony Forloney

Reputation: 91806

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

Upvotes: 1

Related Questions