<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Get and/or set the current cache limiter</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.session-cache-expire.html">session_cache_expire</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.session-commit.html">session_commit</a></div> <div class="up"><a href="ref.session.html">Session Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.session-cache-limiter" class="refentry"> <div class="refnamediv"> <h1 class="refname">session_cache_limiter</h1> <p class="verinfo">(PHP 4 >= 4.0.3, PHP 5)</p><p class="refpurpose"><span class="refname">session_cache_limiter</span> — <span class="dc-title">Get and/or set the current cache limiter</span></p> </div> <div class="refsect1 description" id="refsect1-function.session-cache-limiter-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">string</span> <span class="methodname"><strong>session_cache_limiter</strong></span> ([ <span class="methodparam"><span class="type">string</span> <code class="parameter">$cache_limiter</code></span> ] )</div> <p class="para rdfs-comment"> <span class="function"><strong>session_cache_limiter()</strong></span> returns the name of the current cache limiter. </p> <p class="para"> The cache limiter defines which cache control HTTP headers are sent to the client. These headers determine the rules by which the page content may be cached by the client and intermediate proxies. Setting the cache limiter to <em>nocache</em> disallows any client/proxy caching. A value of <em>public</em> permits caching by proxies and the client, whereas <em>private</em> disallows caching by proxies and permits the client to cache the contents. </p> <p class="para"> In <em>private</em> mode, the Expire header sent to the client may cause confusion for some browsers, including <span class="productname">Mozilla</span>. You can avoid this problem by using <em>private_no_expire</em> mode. The <em>Expire</em> header is never sent to the client in this mode. </p> <p class="para"> Setting the cache limiter to <em>''</em> will turn off automatic sending of cache headers entirely. </p> <p class="para"> The cache limiter is reset to the default value stored in <a href="session.configuration.html#ini.session.cache-limiter" class="link">session.cache_limiter</a> at request startup time. Thus, you need to call <span class="function"><strong>session_cache_limiter()</strong></span> for every request (and before <span class="function"><a href="function.session-start.html" class="function">session_start()</a></span> is called). </p> </div> <div class="refsect1 parameters" id="refsect1-function.session-cache-limiter-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">cache_limiter</code></em></span> <dd> <p class="para"> If <em><code class="parameter">cache_limiter</code></em> is specified, the name of the current cache limiter is changed to the new value. </p> <table class="doctable table"> <caption><strong>Possible values</strong></caption> <thead> <tr> <th>Value</th> <th>Headers sent</th> </tr> </thead> <tbody class="tbody"> <tr> <td><em>public</em></td> <td> <div class="example-contents"> <div class="headercode"><pre class="headercode">Expires: (sometime in the future, according session.cache_expire) Cache-Control: public, max-age=(sometime in the future, according to session.cache_expire) Last-Modified: (the timestamp of when the session was last saved)</pre> </div> </div> </td> </tr> <tr> <td><em>private_no_expire</em></td> <td> <div class="example-contents"> <div class="headercode"><pre class="headercode">Cache-Control: private, max-age=(session.cache_expire in the future), pre-check=(session.cache_expire in the future) Last-Modified: (the timestamp of when the session was last saved)</pre> </div> </div> </td> </tr> <tr> <td><em>private</em></td> <td> <div class="example-contents"> <div class="headercode"><pre class="headercode">Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: private, max-age=(session.cache_expire in the future), pre-check=(session.cache_expire in the future) Last-Modified: (the timestamp of when the session was last saved)</pre> </div> </div> </td> </tr> <tr> <td><em>nocache</em></td> <td> <div class="example-contents"> <div class="headercode"><pre class="headercode">Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache</pre> </div> </div> </td> </tr> </tbody> </table> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.session-cache-limiter-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns the name of the current cache limiter. </p> </div> <div class="refsect1 changelog" id="refsect1-function.session-cache-limiter-changelog"> <h3 class="title">Changelog</h3> <p class="para"> <table class="doctable informaltable"> <thead> <tr> <th>Version</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td>4.2.0</td> <td> The <em>private_no_expire</em> cache limiter was added. </td> </tr> </tbody> </table> </p> </div> <div class="refsect1 examples" id="refsect1-function.session-cache-limiter-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-4766"> <p><strong>Example #1 <span class="function"><strong>session_cache_limiter()</strong></span> example</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /><br /></span><span style="color: #FF8000">/* set the cache limiter to 'private' */<br /><br /></span><span style="color: #0000BB">session_cache_limiter</span><span style="color: #007700">(</span><span style="color: #DD0000">'private'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$cache_limiter </span><span style="color: #007700">= </span><span style="color: #0000BB">session_cache_limiter</span><span style="color: #007700">();<br /><br />echo </span><span style="color: #DD0000">"The cache limiter is now set to </span><span style="color: #0000BB">$cache_limiter</span><span style="color: #DD0000"><br />"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> </p> </div> <div class="refsect1 seealso" id="refsect1-function.session-cache-limiter-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><a href="session.configuration.html#ini.session.cache-limiter" class="link">session.cache_limiter</a></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.session-cache-expire.html">session_cache_expire</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.session-commit.html">session_commit</a></div> <div class="up"><a href="ref.session.html">Session Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>