In the Internet, the word Session has a deep meaning. So what does Session mean? The following php Chinese website will introduce to you what a Session is.
1: What is Session
In professional terms, Session refers to session control, which is a type of session that is stored on the server. Mechanism, when the client accesses the server, the server will record the information on the server in some form, which is exactly the opposite of Cookie.
2: What is the working principle of session
When the client makes a request to the server , the server will save a session. When the session is enabled for the first time, a cookie file is also formed on the client. The session_start() function is used for the first time, and PHP loads the stored session variables and registers the variables through the function. , when the script is executed, it will be automatically saved in the session library for easy use next time.
3: How to use Session
Session is often used to ensure a certain state of information during the session. For example, when users log in, they need to browse web applications. , and the storage is when the page is reloaded, the Session can always be accessed on the device at any time, but as the number of users increases, the Session's server memory will continue to increase, and the Session will also use persistence methods. limit.
Four: What are the characteristics of Session
Session is not thread-safe, and the creation and deletion of Session consumes too many resources, and each Session instance will have own cache.
The above is a complete introduction to what Session is. If you want to know more about php getting started, please pay attention to the php Chinese website.
The above is the detailed content of What is Session. For more information, please follow other related articles on the PHP Chinese website!