Syntax: boolean session_register(string name);
Register new variables.
Return value: Boolean value
Function type: Data processing
Content description
This function adds a variable to the current Session in the global variables. The parameter name is the name of the variable to be added. Returns true value on success.
If you open the session in the header file, that is, use the session_start() function followed by session_register(string name) (such as session_register('username')), then this variable will become a global variable and will affect all calls to session_start() document.
Such as:
session_start();
$username = 'test';
session_register('username');
echo $_session['username']; //Output test
?>
The above introduces the detailed explanation of the session_register function in PHP, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.