Session function of php4 (1). Read the session function of php4 (1). The session function of php4 is better than that of php3. I used it a little bit and made a rough understanding of its function interfaces, internal mechanisms, and convenience of applications. The meaning of a session should be clear to everyone. a session can include http requests and responses several times. for example, we use 163 "> <LINKh php4 to add session support to php3. I used it a little bit. for its function interface, internal mechanism,
I have a rough understanding of the ease of application.
The meaning of a session should be clear. a session can contain http requests and responses several times,
For example, if we use 163.net, from login to logout or timeout, we use it as a session, session
Generally, a unique session ID is generated within the system.
String. In addition to the session ID, a session can also have its own session data.
Record and differentiate different states of the sesion.
Php4 provides the following APIs for session operations:
Session_start-Initialize session data
Session_destroy-Destroys all data registered to a session
Session_name-Get and/or set the current session name
Session_module_name-Get and/or set the current session module
Session_save_path-Get and/or set the current session save path
Session_id-Get and/or set the current session id
Session_register-Register a variable with the current session
Session_unregister-Unregister a variable from the current session
Session_is_registered-Find out if a variable is registered in a session
Session_decode-Decodes session data from a string
Session_encode-Encodes the current session data as a string
Meaning you can understand at a glance that session_start starts a session and session_destroy ends
End a session, session_id to get the current session_id, session_register to the current
Session to register a variable. this is very useful, for example, when a user visits a mall and selects a few items for you.
You can use session_register to send the product name or code to the current session.
For example, the following example (from php manual ):
Session_register ("count ");
$ Count ++;
?>
Hello visitor, you have seen this page Times.
# Is necessary to preserve the session id
# In the case that the user has disabled cookies
To continue, "> click here
Session_register can implicitly stimulate session_start (if the user has not sent a session before _
The current session registers a variable count. each time you click here
This variable will be added. You can try it on your own. The meaning is not repeated.