How to set SESSION_ID in php: First create a PHP sample file; then set the Session ID through the syntax "session_id(string [id]);".
The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer
How to set SESSION_ID in php?
session_id() function introduction
session_id() gets or sets the Session ID
Syntax:
string session_id(string [id]);
If there is no parameter id, it means that only the current Session code, plus parameters means setting the Session code to the newly specified id. Input and return are both strings.
If the parameter ID is not set, it means to obtain the Session ID, otherwise it means to set the Session to the newly specified ID.
Note: IDs are all in string form.
session_id() instance
Get Session ID
<?php session_start(); echo session_id(); // 输出 urles147jbrq3u50b0l6f8hvf0 ?>
Set Session ID
<?php session_id("ilovemanongjc.com"); session_start(); /* http://www.manongjc.com/article/1260.html */ echo session_id(); // 输出 ilovemanongjc.com ?>
[Recommended learning: PHP video tutorial]
The above is the detailed content of How to set SESSION_ID in php. For more information, please follow other related articles on the PHP Chinese website!