Reputation: 23108
I'm using session_cache_limiter() and session_cache_expire() at the top of my PHP 5.1.0 script, just before my session_start().
From PHP help:
[...] you need to call session_cache_limiter() for every request (and before session_start() is called).
But what if I don't call session_start()? Will session_cache_limiter() and session_cache_expire() work without a session_start() after them?
Thanks!
Upvotes: 1
Views: 7723
Reputation: 91806
Example taken straight from "PHP: session_cache_limiter" off php.net
<?php
/* set the cache limiter to 'private' */
session_cache_limiter('private');
$cache_limiter = session_cache_limiter();
echo "The cache limiter is now set to $cache_limiter<br />";
?>
Quoted section below from original is false. See @eCaroth's comment below for corrected information.
Also, it depends on your definition of work, the functions will be called and will not throw an error ifsession_start()
is not called, but thats pointless. The purpose of those functions are for sessions and in order to use sessions you needsession_start()
to be called.
Upvotes: 0
Reputation: 531
NO, ssession_cache_limiter and session_cache_expire merely modify the values php uses for session.cache_limiter and session.cache_expire (which are used when generating the session headers in session_start()) - the functions don't actually send out headers themselves, else you couldn't use them before session_start()
Upvotes: 2