What is the session_register php function used for?
Just like the title says, what is the function session_re开发者_StackOverflowgister( ) used for?
http://php.net/manual/en/function.session-register.php
session_register()
accepts a variable number of arguments, any of which can be either a string holding the name of a variable or an array consisting of variable names or other arrays. For each name,session_register()
registers the global variable with that name in the current session.
This function simply adds a variable to the superglobal $_SESSION array which is used for keeping data for the current session.
A cookie is created in the user's browser, and when the ID in that cookie matches the ID of a session that your server has set up, it sets the $_SESSION array to that matching the ID.
Then this function sets a global pointing to your element in the $_SESSION array.
Note In order to use this function, you'll need to first initialize a session using session_start().
精彩评论