Transfer session information based on website address URL, website address urlsession_php Tutorial

Source: Internet
Author: User

Transfer session information based on website address URL, website address urlsession


In the study of PHP , the session is often used by us, then today we will talk about the session in detail;

First,the working mechanism of the session :
When the session is opened, the server will save the session file in the server, and then save the session ID number in the browser to obtain the corresponding session information;

Second, the following is the focus of the article: URL-based transmission session
If the session is transmitted according to the basic session method, then the cookie in the user's browser will be used, and once the user closes the cookie, the session will not work! So next we are going to put the session ID number on the site's link address, so that the user is not afraid to close the cookie!

(We use simple user login as an example, when the user opens the cookie, it is transmitted in a cookie, and when the cookie is turned off, the URL is transmitted )

1. Set up the user login page and add it after the action address of the form


Sid when a user opens a cookie, the output is empty
Sid when the user closes the cookie, output the current user session information, the specific format is session_name=session_id;

2, establish the judge whether the user login page;


session_id () When a parameter is included, locate the Sessoin file with the ID in the parameter, note that session_id () must precede the session_start ()

3. Create an Exit login page


First, the current user's session data is emptied, and then delete the user's session file
To this entire URL-based transmission session of the small case is done!!

This article belongs to Wang Yip Building's personal blog original, to reprint please indicate the source: Wang Ye Lou's personal blog http://www.ly89.cn/detail/28.html

http://www.bkjia.com/PHPjc/1012253.html www.bkjia.com true http://www.bkjia.com/PHPjc/1012253.html techarticle based on website address URL transmission session information, website address urlsession in PHP learning, the conversation is often used by us, then today we will talk about the session in detail, a ...

  • 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.