<!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>Read session data</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="sessionhandler.open.html">SessionHandler::open</a></div> <div class="next" style="text-align: right; float: right;"><a href="sessionhandler.write.html">SessionHandler::write</a></div> <div class="up"><a href="class.sessionhandler.html">SessionHandler</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="sessionhandler.read" class="refentry"> <div class="refnamediv"> <h1 class="refname">SessionHandler::read</h1> <p class="verinfo">(PHP 5 >= 5.4.0)</p><p class="refpurpose"><span class="refname">SessionHandler::read</span> — <span class="dc-title">Read session data</span></p> </div> <div class="refsect1 description" id="refsect1-sessionhandler.read-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><strong>SessionHandler::read</strong></span> ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$session_id</code></span> )</div> <p class="para rdfs-comment"> Reads the session data from the session storage, and returns the result back to PHP for internal processing. This method is called automatically by PHP when a session is started (either automatically or explicity with <span class="function"><a href="function.session-start.html" class="function">session_start()</a></span> and is preceeded by an internal call to the <span class="function"><a href="sessionhandler.open.html" class="function">SessionHandler::open()</a></span>. </p> <p class="para"> This method wraps the internal PHP save handler defined in the <a href="session.configuration.html#ini.session.save-handler" class="link">session.save_handler</a> ini setting that was set before this handler was set by <span class="function"><a href="function.session-set-save-handler.html" class="function">session_set_save_handler()</a></span>. </p> <p class="para"> If this class is extended by inheritiance, calling the parent <em><code class="parameter">read</code></em> method will invoke the wrapper for this method and therefor invoke the associated internal callback. This allows the method to be overidden and or intercepted and filtered (for example, decrypting <em><code class="parameter">$data</code></em> value returned by the parent <em><code class="parameter">read</code></em> method). </p> <p class="para"> For more information on what this method is expected to do, please refer to the documentation at <span class="function"><a href="sessionhandlerinterface.read.html" class="function">SessionHandlerInterface::read()</a></span>. </p> </div> <div class="refsect1 parameters" id="refsect1-sessionhandler.read-parameters"> <h3 class="title">Parameters</h3> <dl> <dt> <span class="term"><em><code class="parameter">session_id</code></em></span> <dd> <p class="para"> The session id to read data for. </p> </dd> </dt> </dl> </div> <div class="refsect1 returnvalues" id="refsect1-sessionhandler.read-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns an encoded string of the read data. If nothing was read, it must return an empty string. Note this value is returned internally to PHP for processing. </p> </div> <div class="refsect1 seealso" id="refsect1-sessionhandler.read-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> The <a href="session.configuration.html#ini.session.serialize-handler" class="link">session.serialize_handler</a> configuration directive. </li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="sessionhandler.open.html">SessionHandler::open</a></div> <div class="next" style="text-align: right; float: right;"><a href="sessionhandler.write.html">SessionHandler::write</a></div> <div class="up"><a href="class.sessionhandler.html">SessionHandler</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>