2010-03-28 22:10:10 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2009-07-11 08:54:10 +00:00
|
|
|
<!-- $Revision$ -->
|
2020-11-29 15:51:04 +00:00
|
|
|
<refentry xml:id="function.session-id" xmlns="http://docbook.org/ns/docbook">
|
2005-07-08 17:25:53 +00:00
|
|
|
<refnamediv>
|
|
|
|
<refname>session_id</refname>
|
|
|
|
<refpurpose>Get and/or set the current session id</refpurpose>
|
|
|
|
</refnamediv>
|
2005-07-08 18:12:55 +00:00
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
2005-07-08 17:25:53 +00:00
|
|
|
<methodsynopsis>
|
2020-11-29 15:51:04 +00:00
|
|
|
<type class="union"><type>string</type><type>false</type></type><methodname>session_id</methodname>
|
|
|
|
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>id</parameter><initializer>&null;</initializer></methodparam>
|
2005-07-08 17:25:53 +00:00
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
2005-07-08 18:12:55 +00:00
|
|
|
<function>session_id</function> is used to get or set the session id for
|
|
|
|
the current session.
|
2005-07-08 17:25:53 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2009-05-03 15:59:44 +00:00
|
|
|
The constant <constant>SID</constant> can also be used to
|
2005-07-08 17:25:53 +00:00
|
|
|
retrieve the current name and session id as a string suitable for
|
2005-09-17 10:25:08 +00:00
|
|
|
adding to URLs. See also <link linkend="ref.session">Session
|
|
|
|
handling</link>.
|
2005-07-08 17:25:53 +00:00
|
|
|
</para>
|
2005-07-08 18:12:55 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
2005-07-08 17:25:53 +00:00
|
|
|
<para>
|
2005-07-08 18:12:55 +00:00
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>id</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2020-11-29 15:51:04 +00:00
|
|
|
If <parameter>id</parameter> is specified and not &null;, it will replace the current
|
2005-07-08 18:12:55 +00:00
|
|
|
session id. <function>session_id</function> needs to be called before
|
|
|
|
<function>session_start</function> for that purpose. Depending on the
|
|
|
|
session handler, not all characters are allowed within the session id.
|
|
|
|
For example, the file session handler only allows characters in the
|
2009-01-19 12:37:57 +00:00
|
|
|
range <literal>a-z A-Z 0-9 , (comma) and - (minus)</literal>!
|
2005-07-08 18:12:55 +00:00
|
|
|
</para>
|
|
|
|
<note>
|
|
|
|
<simpara>
|
|
|
|
When using session cookies, specifying an <parameter>id</parameter>
|
|
|
|
for <function>session_id</function> will always send a new cookie
|
|
|
|
when <function>session_start</function> is called, regardless if the
|
|
|
|
current session id is identical to the one being set.
|
|
|
|
</simpara>
|
|
|
|
</note>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
|
|
|
<para>
|
|
|
|
<function>session_id</function> returns the session id for the current
|
|
|
|
session or the empty string (<literal>""</literal>) if there is no current
|
|
|
|
session (no current session id exists).
|
2020-11-29 15:51:04 +00:00
|
|
|
On failure, &false; is returned.
|
2005-07-08 18:12:55 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
2020-11-29 15:51:04 +00:00
|
|
|
<refsect1 role="changelog">
|
|
|
|
&reftitle.changelog;
|
|
|
|
<informaltable>
|
|
|
|
<tgroup cols="2">
|
|
|
|
<thead>
|
|
|
|
<row>
|
|
|
|
<entry>&Version;</entry>
|
|
|
|
<entry>&Description;</entry>
|
|
|
|
</row>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<row>
|
|
|
|
<entry>8.0.0</entry>
|
|
|
|
<entry>
|
|
|
|
<parameter>id</parameter> is nullable now.
|
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
</tbody>
|
|
|
|
</tgroup>
|
|
|
|
</informaltable>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="seealso">
|
2005-07-08 18:12:55 +00:00
|
|
|
&reftitle.seealso;
|
|
|
|
<para>
|
|
|
|
<simplelist>
|
|
|
|
<member><function>session_regenerate_id</function></member>
|
|
|
|
<member><function>session_start</function></member>
|
|
|
|
<member><function>session_set_save_handler</function></member>
|
|
|
|
<member>
|
|
|
|
<link linkend="ini.session.save-handler">session.save_handler</link>
|
|
|
|
</member>
|
|
|
|
</simplelist>
|
2005-07-08 17:25:53 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
</refentry>
|
2002-04-15 00:12:54 +00:00
|
|
|
<!-- Keep this comment at the end of the file
|
|
|
|
Local variables:
|
|
|
|
mode: sgml
|
|
|
|
sgml-omittag:t
|
|
|
|
sgml-shorttag:t
|
|
|
|
sgml-minimize-attributes:nil
|
|
|
|
sgml-always-quote-attributes:t
|
|
|
|
sgml-indent-step:1
|
|
|
|
sgml-indent-data:t
|
|
|
|
indent-tabs-mode:nil
|
|
|
|
sgml-parent-document:nil
|
2009-09-25 07:04:39 +00:00
|
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
2002-04-15 00:12:54 +00:00
|
|
|
sgml-exposed-tags:nil
|
|
|
|
sgml-local-catalogs:nil
|
|
|
|
sgml-local-ecat-files:nil
|
|
|
|
End:
|
|
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
|
|
vim: et tw=78 syn=sgml
|
|
|
|
vi: ts=1 sw=1
|
|
|
|
-->
|