The http protocol is a stateless connection. If you want to track user behavior, you must have a variable that can work on a different page. In PHP, it can be implemented using cookies and sessions.
Everyone is familiar with cookies. They just save variables as a file on the client. However, if the client prohibits cookies, there is nothing you can do. This requires session. In PHP4, session can be implemented in two ways. One is to use cookies, that is, save the session ID in the cookie file; the other is to attach the session ID to the URL and pass it.
Although there are two ways to achieve this, programmers don’t need to worry about which method to use. PHP will automatically check the client’s cookie settings (referring to linux/unix platforms, unknown to Win32), and the default is to use it first. cookie (you can modify the value of session.use_cookies in the [session] section of the php.ini file to change it). Of course, you can also force the use of URL to pass SessionID, as follows:
">Submit form
Just add a =sessionID;?> to the link. Simple, right? There are many settings about Session in php.ini , such as session.cookie_lifetime is the valid time of the session, etc., are all in the [session] section. If you look at it, you will have a better understanding of the session in PHP