<!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>Encodes the current session data as a session encoded string</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.session-destroy.html">session_destroy</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.session-get-cookie-params.html">session_get_cookie_params</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-encode" class="refentry"> <div class="refnamediv"> <h1 class="refname">session_encode</h1> <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">session_encode</span> — <span class="dc-title">Encodes the current session data as a session encoded string</span></p> </div> <div class="refsect1 description" id="refsect1-function.session-encode-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">string</span> <span class="methodname"><strong>session_encode</strong></span> ( <span class="methodparam">void</span> )</div> <p class="para rdfs-comment"> <span class="function"><strong>session_encode()</strong></span> returns a serialized string of the contents of the current session data stored in the $_SESSION superglobal. </p> <p class="para"> Please note, the serialization method is not the same as <span class="function"><a href="function.serialize.html" class="function">serialize()</a></span>. The serialization method is internal to PHP and can be set using <a href="session.configuration.html#ini.session.serialize-handler" class="link">session.serialize_handler</a>. </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.session-encode-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns the contents of the current session encoded. </p> </div> <div class="refsect1 notes" id="refsect1-function.session-encode-notes"> <h3 class="title">Notes</h3> <div class="warning"><strong class="warning">Warning</strong> <p class="para"> Must call <span class="function"><a href="function.session-start.html" class="function">session_start()</a></span> before using <span class="function"><a href="function.session-decode.html" class="function">session_decode()</a></span>. </p> </div> </div> <div class="refsect1 seealso" id="refsect1-function.session-encode-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.session-decode.html" class="function" rel="rdfs-seeAlso">session_decode()</a> - Decodes session data from a session encoded string</span></li> <li class="member"><a href="session.configuration.html#ini.session.serialize-handler" class="link">session.serialize_handler</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-destroy.html">session_destroy</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.session-get-cookie-params.html">session_get_cookie_params</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>