Transmits session information based on the URL of the website address. the URL of the website is urlsession. The session information is transmitted based on the URL of the website address. the URL of the website address is often used in php learning. today, let's talk about the session in detail; one is to transmit session information based on the URL of the website address urlsession
InPhpIn learning, sessions are often used, so today we will discuss in detailSession;
I,Session working mechanism:
When the session is enabled, the server saves the session file on the server, and then saves the session id in the browser to obtain the corresponding session information;
II. the following is the focus of the article:URL-based transfer session
If the session is transmitted using the basic session method, the cookie in the user's browser will be used. Once the user closes the cookie, the session will not work! So next we will put the session id on the link address of the website, so that users are not afraid to close the cookie!
(Using simple user logon as an example,When cookies are enabled, they are transmitted using cookies. when cookies are disabled, they are transmitted using URLs.)
1. create a user logon page and add
SID: when the cookie is enabled, the output is empty.
SID: when the cookie is disabled, the current user's session information is output. the specific format is session_name = session_id;
2. create a logon page to determine whether a user is logged on;
Session_id () indicates that the sessoin file is found based on the id in the parameter. Note that session_id () must be before session_start ().
3. create an exit logon page
First, clear the session data of the current user, and then delete the session file of the current user.
This is a small case of url-based session transmission !!
This article is original to Wang yelou's personal blog. if you want to reprint it, please indicate the source:Wang yelou's personal blog http://www.ly89.cn/detail/28.html
In php learning, session is often used. today we will talk about session in detail; 1...