session_id
(PHP 4, PHP 5, PHP 7)
session_id — Get and/or set the current session id
Description
$id
] ) : stringsession_id() is used to get or set the session id for the current session.
The constant SID
can also be used to
retrieve the current name and session id as a string suitable for
adding to URLs. See also Session
handling.
Parameters
-
id
-
If
id
is specified, it will replace the current session id. session_id() needs to be called before session_start() 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 range a-z A-Z 0-9 , (comma) and - (minus)!Note: When using session cookies, specifying an
id
for session_id() will always send a new cookie when session_start() is called, regardless if the current session id is identical to the one being set.
Return Values
session_id() returns the session id for the current session or the empty string ("") if there is no current session (no current session id exists).
See Also
- session_regenerate_id() - Update the current session id with a newly generated one
- session_start() - Start new or resume existing session
- session_set_save_handler() - Sets user-level session storage functions
- session.save_handler
English translation
You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.
Thank you in advance.
Document created the 30/01/2003, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/php-rf-session-id.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.