Welcome to the Linux community forum and interact with 2 million technical staff to understand the cookie: cookie is a gift from the server to the client (small dessert ), one way to complete Server Authentication for users is to use the setCookie function to store the server in the browser of the client when the user logs on to the server.
Welcome to the Linux community forum and interact with 2 million technical staff> understanding cookie: cookie is a gift (small dessert) left by the server to the client ), one way to complete Server Authentication for users is to use the setCookie function to store the server in the browser of the client when the user logs on to the server.
Welcome to the Linux community forum and interact with 2 million technicians>
Understanding of cookies: cookies are a gift (small dessert) left by the server to the client to complete Server Authentication for the user. Specifically, when a user logs on to the server, the server uses the setCookie function to store some identification data (user name, password, logon or not) in the browser of the client ). When the same user accesses other web pages of the site, the server will determine whether the behavior of the same user is based on the data.
In addition, the key function setCookie () is used to reuse cookies. Therefore, the cookie application is quite simple.
Understanding of the session: the session is a verification method for storing personal information on the server, but there is also a way to connect to the client, therefore, there are two different url-based and cookie-based session methods.
Session_start ()
Session_id ()
$ _ SESSION: The functions of these sessions are fully understood. When session_start () is executed, the session_id () value is generated; otherwise, the echo session () is output (); no results. In addition, the values in the $ _ SESSION created at this time, such as $ _ SESSION ["name"] = "zhangsan"; $ _ SESSION ["age"] = 23; these values will be associated with session_id (), for example, members in a group.
When you jump to another interface, the first step is to execute session_start ().
At this time, the system will determine whether there is an existing session_id. If there is and the same as the previous one, it will be better, the current value in the $ _ SESSION array is still a member of the original group. If the system does not find session_id, sorry. I have to create another session_id, but this is another group. It has nothing to do with the original session_id or $ _ SESSION, understanding the cookie-based or url-based session based on this idea will make you better understand it.