Home > Article > Backend Development > What is the function of session
The function of session is to save the private information of each user; when a user accesses, the server will assign a unique Session ID to each user, and it can be taken out from the user's session when accessing other programs. The user's data serves the user.
Recommended: "session Session Topic"
session is used to save each user When a user accesses, the server will assign a unique Session ID to each user, and when accessing other programs, the user's data can be taken out from the user's session to serve the user
What is session
In WEB development, the server can create a session object (session object) for each user browser. Note: One browser has one exclusive session object (by default). Therefore, when user data needs to be saved, the server program can write the user data to a session exclusive to the user's browser. When the user uses the browser to access other programs, other programs can retrieve the user's data from the user's session and provide the user with the user's data. Serve.
The role of session
Session is used to save the private information of each user. When each client user accesses, the server assigns a unique Session ID (Session ID). Her lifetime is the user's continuous request time plus a period of time (usually about 20 minutes).
The information in the Session is stored in the Web server content, and the amount of data saved can be large or small. The saved data information will be automatically released when the Session times out or is closed. Using a Session object makes saving user data inefficient since it remains in memory for some time after the user stops using the application. For small amounts of data, using Session objects to save them is still a good choice.
The above is the detailed content of What is the function of session. For more information, please follow other related articles on the PHP Chinese website!