Home  >  Article  >  Backend Development  >  PHP learning the difference between session and cookie

PHP learning the difference between session and cookie

黄舟
黄舟Original
2016-12-24 09:42:031333browse

After briefly talking about the common sense of session and cookie, I will tell the majority of PHP learners about the main differences between the two.                                                                                                                                                                                     saves the client’s status on the server side. The user’s information can be saved as long as the browser is not closed. Usually, the user’s login information is saved.

And cookie saves information on the client, it is written to a file.

  Session is implemented using cookie technology (which will be introduced in detail later). First, a cookie containing sessionid is saved on the client side, and other session amounts are saved on the server side. When the user requests a service, the sessionid will be sent to the server together. The user can be identified by extracting the variables stored on the server side through the sessionid. Of course, if the client disables cookies, the session will be invalid at this time.

The above is the content of PHP learning about the difference between session and cookie. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn