This article mainly introduces the add, delete, modify and view operations of PHP SESSION. This article directly gives operational examples. , friends in need can refer to it
The difference between SESSION and COOKIE is that the cookie file is saved on the client, while the session is saved on the server. In comparison, in order to improve certain security, session has more advantages.
Because the session is generally managed by the server administrator on the server side, but the cookie is saved on the client side and can be viewed by anyone. If not specified, the password is also saved in clear text, so the security is obvious.
And session is relatively more powerful and can save arrays and even objects. To some extent, it can reduce development costs.
The following is the session usage code:
Increase of session data:
The code is as follows:
The code is as follows:
The modification of session is the addition of session data.
Viewing session data means taking out session data.
The code is as follows:
Both cookies and sessions end with a session, that is, closing the browser ends a session.