1
0
mirror of https://github.com/php/doc-ja.git synced 2026-04-25 00:48:05 +02:00
Files
archived-doc-ja/reference/session/functions/session-id.xml
T

129 lines
4.2 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: f5c124befdf7c2791877694a86ead123b179d935 Maintainer: hirokawa Status: ready -->
<!-- Credits: mumumu -->
<refentry xml:id="function.session-id" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>session_id</refname>
<refpurpose>現在のセッション ID を取得または設定する</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<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>
</methodsynopsis>
<para>
<function>session_id</function> は現在のセッション ID を取得
または設定するために使用されます。
</para>
<para>
現在の名前とセッション ID を、URL に追加可能な文字列として取得する
ために定数 <constant>SID</constant> も使用できます。
<link linkend="ref.session">セッションハンドリング</link>
も参照ください。
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>id</parameter></term>
<listitem>
<para>
<parameter>id</parameter> が指定され、&null; でない場合、現在の
セッション ID を置換します。その際、
この関数は <function>session_start</function>
より前にコールされている必要があります。
セッションハンドラによっては、セッション ID として使用できる文字に
制限がある場合があります。例えば、ファイルによるセッションハンドラでは
セッション ID として使える文字は
<literal>[a-zA-Z0-9,-]</literal>
に限られます!
</para>
<note>
<simpara>
セッション保持にクッキーを使用している場合、
<function>session_id</function> において
<parameter>id</parameter> 引数を指定すると、
現在のセッション ID がセットされるものと
まったく同一であるかどうかに関わらず、
<function>session_start</function>
が呼び出される際に常に新しいクッキーが送信されます。
</simpara>
</note>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<function>session_id</function> は現在のセッションのセッション ID を返します。
現在のセッションが存在しない (現在のセッション ID が存在しない)
場合は空文字列 (<literal>""</literal>) を返します。
失敗時には、&false; を返します。
</para>
</refsect1>
<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> は、nullable になりました。
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="seealso">
&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>
</para>
</refsect1>
</refentry>
<!-- 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
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
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
-->