mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
[session] Simplify the basic session introduction. This information is duplicated elsewhere.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@324172 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
725924e665
commit
a7b98eb2db
1 changed files with 1 additions and 33 deletions
|
@ -5,7 +5,6 @@
|
|||
&reftitle.examples;
|
||||
<section xml:id="session.examples.basic">
|
||||
<title>Basic usage</title>
|
||||
<note>
|
||||
<para>
|
||||
Sessions are a simple way to store data for individual users against a unique session ID.
|
||||
This can be used to persist state information between page requests. Session IDs are normally
|
||||
|
@ -37,16 +36,7 @@
|
|||
Sessions normally shutdown automatically when PHP is finished executing a script, but can be
|
||||
manually shutdown using the <function>session_write_close</function> function.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
Use of <varname>$_SESSION</varname> (or
|
||||
<varname>$HTTP_SESSION_VARS</varname> with PHP 4.0.6 or less) is
|
||||
recommended for improved security and code readability. With
|
||||
<varname>$_SESSION</varname>, there is no need to use the
|
||||
<function>session_register</function>,
|
||||
<function>session_unregister</function>,
|
||||
<function>session_is_registered</function> functions. Session variables
|
||||
are accessible like any other variables.
|
||||
<example>
|
||||
<title>
|
||||
Registering a variable with <varname>$_SESSION</varname>.
|
||||
|
@ -66,9 +56,7 @@ if (!isset($_SESSION['count'])) {
|
|||
</example>
|
||||
<example>
|
||||
<title>
|
||||
Unregistering a variable with <varname>$_SESSION</varname> and
|
||||
<link
|
||||
linkend="ini.register-globals">register_globals</link> disabled.
|
||||
Unregistering a variable with <varname>$_SESSION</varname>.
|
||||
</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
|
@ -96,26 +84,6 @@ unset($_SESSION['count']);
|
|||
to restore a reference to another variable.
|
||||
</para>
|
||||
</warning>
|
||||
<para>
|
||||
If <link
|
||||
linkend="ini.register-globals">register_globals</link>
|
||||
is enabled, then each global variable can be registered as session
|
||||
variable. Upon a restart of a session, these variables will be restored
|
||||
to corresponding global variables. Since PHP must know which global
|
||||
variables are registered as session variables, users need to register
|
||||
variables with <function>session_register</function> function.
|
||||
You can avoid this by simply setting entries in
|
||||
<varname>$_SESSION</varname>.
|
||||
</para>
|
||||
<para>
|
||||
If <link
|
||||
linkend="ini.register-globals">register_globals</link>
|
||||
is enabled, then the global variables and the
|
||||
<varname>$_SESSION</varname> entries will automatically reference the
|
||||
same values which were registered in the prior session instance.
|
||||
However, if the variable is registered by <varname>$_SESSION</varname>
|
||||
then the global variable is available since the next request.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section xml:id="session.idpassing">
|
||||
|
|
Loading…
Reference in a new issue