: This article mainly introduces php session management. if you are interested in PHP tutorials, refer to it.
1. cookie
1. how to obtain the value in the cookie?
In the example, jump to a. php through index. php to get the corresponding name of the key jason;
Index. php code:
A. php code;
Run the following command in Firefox:
2. how to access cookies through javascript?
In index. php, use the pop-up box
Cookie Knowledge PointScript // use js to obtain the cookie alert (document. cookie); script
Display result:
3. if the browser or user disables cookies, how does one pass parameters between pages?
The example uses the URL parameter to pass the B. php value to c. php;
B. php code:
C. php code:
You can GET the rose value of the corresponding key through $ _ GET.II. session:
1. each time you open the browser again, the server will assign a new session_id value to the client.
2. if you get the value corresponding to the session key?In the example, jump to a. php through index. php and display the value corresponding to the session key:
Index. php code;
A. php code:
The last page is displayed successfully.3. what should I do if I want to destroy the session? (Ps application scenario: Clear the logon status after timeout)
Php provides session_destroy () to destroy sessions.
Insert session_destroy () in index. php ():
Then, the page is displayed with no name found.
The above introduces the php session management, including the content, hope to be helpful to friends who are interested in the PHP Tutorial.