Session is a conversational technology that is based on cookies and is more secure than cookies.
1.session principle, the session will send a session ID to the client, and at the same time set up a session data area on the server, the client
Compared with cookies in PHP development, Session is stored on the server, which is relatively secure and has a storage length limit unlike Cookie. This article briefly introduces the use of Session.
The Session is stored on the server as a text
Some of my friends will ask how the Session works. What is the difference between it and cookies? Next, let's introduce the working principle of the Session to all of you, for more information, see.
1. What is Session?
2. The Session starts when the
DeleteMethod 1: Set its value to an empty stringSetcookie (' user[name] ', ');Method 2: Set the target cookie to the "expired" state.The lifetime of the cookie is set to expire, and the lifetime is the same as the browser, which is deleted when the
The Session is stored on the server as a text file, so the client is not afraid to modify the Session content. In fact, in the Session file on the server side, PHP automatically modifies the session file permissions, only retaining the system read
Redis/Distributed File Storage System/database storage session solves session inconsistency in the Server Load balancer cluster, redissession
Let's talk about the similarities and differences between sessions and cookies.
Session and cookie are
When using yii to log on, I set the second parameter $ duration to 86400, which saves the user's login information to the cookie for 24 hours. {Code...} when I want to parse the cookie, I find that the cookie is like this. {Code ...} but how can I
I. Problem OriginWebsites with a slightly larger size usually have several servers. Each server runs modules with different functions and uses different second-level domain names. The user system of a website with a strong integrity is unified, that
Using swfupload to upload the $ _ FILES variable is always blankToday, we use HiChina's M3 virtual host, linux system, and apache server. After a program tested locally and other servers is uploaded to the HiChina M3 host, the system prompts that
1. The time format for printing out the previous day in PHP is 2006-5-10 22:21:21. echo Date (' y-m-d h:i:s ', strtotime ('-1 days '));2. Do not use the third variable to exchange the value of two Variables. $a = "php"; $b = "java"; $a = explode ('-'
How to obtain the last session data of the browser:
Do you want to know what session_id is for the last session?
Do you want the PHPSESSID value stored in the cookie to be deleted as soon as the browser exits?
Therefore, we need to set our own
The session of PHP is saved in the server, the cookie is saved in the client browser, the two are connected by PHPSESSID (by default, modifiable), with PHPSESSID cookie request server, server in PHP session.save_ Path set in the folder to find the
1. PHP CookiesA cookie is a mechanism for storing data on a remote browser to track and identify users.PHP sends a cookie in the header of the HTTP protocol, so the Setcookie () function must be called before other information is exported to the
(1) Open the link to the page, the topic is as follows(2) Decode the prompt dXNlcl9sb2dpbj0yMTIzMmYyOTdhNTdhNWE3NDM4OTRhMGU0YTgwMWZjMzsgcGFzc3dvcmQ9NGM3ODM4NDVkM2E0ODk0ZmFmYTNhMWJmOGE4ZDRlN2U7IGFzZGNhc2M7IFBIUFNFU1NJRD02bzA3Z3E1a2szOXE2NnI5NmFvMmQ4
In the implementation of the session using cookie technology, session will save a session_id (session number) in the client cookie, the server side to save other session variables, such as Session_name and so on. When the user requests the server
Comparing the cookie,session is stored on the server side of the session, relatively secure, and does not have the storage length limit as cookies do, this article briefly describes the use of sessions. because the session is stored in the form of
When you set up a COOKIE on a page, you must refresh or go to the next page to get the value of the variable with $_cookie.
The reason is because when the page is first accessed by the browser, the cookie in the page is set up and sent to the
Comparing the cookie,session is stored on the server side of the session, relatively secure, and does not have the storage length limit as cookies do, this article briefly describes the use of sessions.Because the session is stored as a text file on
1. What is session
2.Session from the User access page, to disconnect from the Web site to form a session life cycle. During a session, the client is assigned a unique sessionid to identify the current user and differentiate it from other
Because the session is stored as a text file on the server side, the client is not afraid to modify session content. In fact, the server-side session file, PHP automatically modify the session file permissions, only the system to read and write
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.