Source of: /manual/en/function.session-cache-limiter.php
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.session.inc";
$setup = array (
'home' =>
array (
0 => 'index.php',
1 => 'PHP Manual',
),
'head' =>
array (
0 => 'UTF-8',
1 => 'en',
),
'this' =>
array (
0 => 'function.session-cache-limiter.php',
1 => 'session_cache_limiter',
),
'up' =>
array (
0 => 'ref.session.php',
1 => 'Session Functions',
),
'prev' =>
array (
0 => 'function.session-cache-expire.php',
1 => 'session_cache_expire',
),
'next' =>
array (
0 => 'function.session-commit.php',
1 => 'session_commit',
),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);
manual_header();
?>
<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>
<a name="function.session-cache-limiter.description"></a><div class="refsect1 description">
<h3 class="title">Description</h3>
<div class="methodsynopsis dc-description">
<span class="type">string</span> <span class="methodname"><b>session_cache_limiter</b></span>
([ <span class="methodparam"><span class="type">string</span> <tt class="parameter">$cache_limiter</tt></span>
] )</div>
<p class="para rdfs-comment">
<b>session_cache_limiter()</b> 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 <i>nocache</i> disallows any client/proxy caching.
A value of <i>public</i> permits caching by proxies and the
client, whereas <i>private</i> disallows caching by proxies
and permits the client to cache the contents.
</p>
<p class="para">
In <i>private</i> 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 <i>private_no_expire</i> mode. The
<i>Expire</i> header is never sent to the client in this mode.
</p>
<p class="para">
The cache limiter is reset to the default value stored in
<a href="session.configuration.php#ini.session.cache-limiter" class="link">session.cache_limiter</a>
at request startup time. Thus, you need to call
<b>session_cache_limiter()</b> for every
request (and before <a href="function.session-start.php" class="function">session_start()</a> is called).
</p>
</div>
<a name="function.session-cache-limiter.parameters"></a><div class="refsect1 parameters">
<h3 class="title">Parameters</h3>
<p class="para">
</p><dl>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">cache_limiter</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
If <i><tt class="parameter">cache_limiter</tt></i>
is specified, the name of the
current cache limiter is changed to the new value.
</p>
<table class="doctable table">
<caption><b>Possible values</b></caption>
<thead valign="middle">
<tr valign="middle">
<th>Value</th>
<th>Headers sent</th>
</tr>
</thead>
<tbody valign="middle" class="tbody">
<tr valign="middle">
<td align="left"><i>public</i></td>
<td align="left">
<div class="example-contents programlisting">
<div class="headercode"><pre class="headercode">Expires: (sometime in the future, according session.cache_expires)
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 valign="middle">
<td align="left"><i>private_no_expire</i></td>
<td align="left">
<div class="example-contents programlisting">
<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 valign="middle">
<td align="left"><i>private</i></td>
<td align="left">
<div class="example-contents programlisting">
<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 valign="middle">
<td align="left"><i>nocache</i></td>
<td align="left">
<div class="example-contents programlisting">
<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>
</dl>
<p>
</p>
</div>
<a name="function.session-cache-limiter.returnvalues"></a><div class="refsect1 returnvalues">
<h3 class="title">Return Values</h3>
<p class="para">
Returns the name of the current cache limiter.
</p>
</div>
<a name="function.session-cache-limiter.changelog"></a><div class="refsect1 changelog">
<h3 class="title">Changelog</h3>
<p class="para">
</p><table class="doctable informaltable">
<thead valign="middle">
<tr valign="middle">
<th>Version</th>
<th>Description</th>
</tr>
</thead>
<tbody valign="middle" class="tbody">
<tr valign="middle">
<td align="left">4.2.0</td>
<td align="left">
The <i>private_no_expire</i> cache limiter was added.
</td>
</tr>
</tbody>
</table>
<p>
</p>
</div>
<a name="function.session-cache-limiter.examples"></a><div class="refsect1 examples">
<h3 class="title">Examples</h3>
<p class="para">
</p><div class="example">
<p><b>Example #1 <b>session_cache_limiter()</b> example</b></p>
<div class="example-contents programlisting">
<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>
</p>
</div>
<a name="function.session-cache-limiter.seealso"></a><div class="refsect1 seealso">
<h3 class="title">See Also</h3>
<p class="para">
</p><ul class="simplelist">
<li class="member"><a href="session.configuration.php#ini.session.cache-limiter" class="link">session.cache_limiter</a></li>
</ul><p>
</p>
</div>
</div><?php manual_footer(); ?>