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