Detailed explanation of session_register function in PHP

WBOY
Release: 2016-07-30 13:30:24
Original
978 people have browsed it

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.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!