1. Cookie
1. How to get the value in cookie?
Example jumps to a.php through index.php to get the corresponding value jason with the key name;
index.php code:
Copy after login
Copy after login
2. How to access cookies through javascript?
Example displays results through pop-up box
cookie知识点
3. If the browser or user has disabled cookies, how to pass parameters between pages?
Example passes the value of b.php to c.php through URL parameters;
b.php code:
Copy after login
Copy after login
二.session:
1. Each time the browser is reopened, the server will assign a new session_id value to the client.
Copy after login
Example jumps to a.php through index.php to display the value corresponding to the corresponding key of the session:
index.php code;
Copy after login
Copy after login
3. What should I do if I want to destroy the session? (ps application scenario: clear login status after timeout)
PHP provides session_destroy() to destroy the session.
Insertsession_destroy() in index.php:
Copy after login
The above introduces the session management of PHP, including various aspects. I hope it will be helpful to friends who are interested in PHP tutorials.