session_name
Get and/or set the current session name
Function name: session_name()
Applicable version: PHP 4, PHP 5, PHP 7
Function Description: The session_name() function is used to get or set the name of the current session.
usage:
Get the name of the current session:
$name = session_name(); echo $name; // 输出当前会话的名称
Set the name of the current session:
session_name("new_session_name");
Example:
Get the name of the current session:
session_start(); $name = session_name(); echo $name; // 输出当前会话的名称,例如:PHPSESSID
Set the name of the current session:
session_name("my_session"); session_start(); $name = session_name(); echo $name; // 输出设置后的会话名称,例如:my_session
Notes: