PhpSession
The PHP session variable is used to store information about user sessions (session) or to change settings for user sessions. The Session variable stores information for a single user and is available for all pages in the application.
PHP Session variables
When you manipulate an application on your computer, you open it, make some changes, and then close it. It's much like a conversation (session). The computer knows who you are. It knows when you open and close the application. However, the problem arises on the Internet: the WEB server does not know who you are and what you have done because the HTTP address cannot remain in the state.
The PHP session solves this problem by storing user information on the server for subsequent use (e.g., user name, purchase of goods, etc.). However, the session information is temporary and will be deleted when the user leaves the site. If you need to store information permanently, you can store the data in a database.
The Session works by creating a unique ID (UID) for each visitor and storing the variables based on this UID. The UID is stored in a cookie or transmitted through a URL.
1<?PHP2 Session_Start();//Opening Session Sessions3 if(isset($_session[' views '])) {//Use the Isset function to determine if a cookie exists,4 $_session[' Views ']=$_session[' Views ']+1;//the original value of the cookie is +15}Else{6 $_session[' Views ']=1;//Assign 1 to $_session[' views ';7 }8 Echo"Browse Volume:".$_session[' views '];//output Native-stored session9 unset($_session[' views ']);//Releasing session VariablesTen Session_destroy();//destroy, kill the session . One?> A<meta charset= "Utf-8"/>
The Session_Start function must precede the HTML tag;
Session in PHP creates a print release destroy;