Review of the session function of PHP4 (i) _php tutorial

Source: Internet
Author: User
PHP4 a new session support than PHP3. A little bit, for its function interface, the internal mechanism,
A general understanding of the convenience of the application.
The meaning of the session everyone should be aware that a session can include a number of HTTP requests and responses,
For example, we use 163.net, from login to logout or timeout as a session,session
is typically a unique session ID within the system, typically a very long
String. A session in addition to the session ID, you can also have their own session data, you can
Record and differentiate the different states of sesion.

The 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 are registered in a session
Session_decode-decodes session data from a string
Session_encode-encodes the current session data as a string

Meaning everyone can see, Session_Start began a Session,session_destroy knot
Bundle a session,session_id to get the current session_id,session_register to the current
Session to register a variable, this is useful, such as users go shopping malls, selected some of the products you
You can use Session_register to register the product name or code with the current session.

For example (excerpt from PHP manual):

Session_register ("Count");
$count + +;
?>

Hello visitor, you are seen this page Times.


# necessary to preserve the session ID
# in the case, the user has disabled cookies

To continue, ' >click here

Session_register can implicitly excite session_start (if the user has not previously sent Session_
Start call), the current session registers a variable count, each time the user clicks the click here
, this variable will increase by one. You can try it yourself. The meaning is not much to repeat.

http://www.bkjia.com/PHPjc/315851.html www.bkjia.com true http://www.bkjia.com/PHPjc/315851.html techarticle PHP4 A new session support than PHP3. A little use of it, the function of the interface, the internal mechanism, the application of the convenience of doing a rough understanding. The meaning of the session everyone should be clear, one ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.