Home > Backend Development > PHP Tutorial > Review of the session function of easyrecovery professional php4 (1)

Review of the session function of easyrecovery professional php4 (1)

WBOY
Release: 2016-07-29 08:33:41
Original
1034 people have browsed it

PHP4 has new session support than PHP3. After using it for a while, I got a general understanding of its function interface, internal mechanism, and
convenience of application.
Everyone should be clear about the meaning of session. A session can include several http requests and responses.
For example, if we use 163.net, from login to logout or timeout, it is regarded as a session. The unique identifier of the session
is usually within the system. Generate a unique session ID, usually a very long
string. In addition to the session ID, a session can also have its own session data, which can record and distinguish different statuses of the session.
php4 provides the following interfaces 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
You can understand the meaning at a glance, session_start starts a session, session_destroy ends
Ends a session, session_id is obtained The current session_id, session_register registers a variable with the current session. This is very useful. For example, when a user visits a mall and selects certain products, you can use session_register to register the product name or code into the current session.
For example, the following example (extracted from php manual):
session_register("count");
$count++;
?>
Hello visitor, you have seen this page times.


# the is necessary to preserve the session id
# in the case that the user has disabled cookies
To continue, click here
session_register can implicitly trigger session_start (if the user has not sent a session_
start call before), the current session registers a variable count, every time the user clicks click When here
, this variable will be increased by one. You can try it yourself. The meaning of is not detailed here.

The above introduces the review of the session function of easyrecovery professional php4 (1), including the content of easyrecovery professional. 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