When you run an app, you open it, make changes, and then close it. It's a lot like a session. The computer knows who you are. It knows when you start the application and when it terminates it. But on the Internet, there's a problem: the server doesn't know who you are and what you do, and that's because HTTP addresses don't maintain state.
PHP session solves this problem by storing user information on the server for subsequent use (such as user name, purchased items, etc.). However, session information is temporary and will be deleted after the user leaves the site. If you need to store information permanently, you can store the data in a database.
Copy the manual, try each one and write it out for your own reference. Who told us to just learn it? Session has about 12 functions:
session_start: initial session.
session_destroy: End session.
session_unset: Release session memory.
session_name: access the current session name.
session_module_name: access the current session module.
session_save_path: access the current session path.
session_id: access the current session code.
session_register: Register new variables.
session_unregister: Delete registered variables.
session_is_registered: Check whether the variable is registered.
session_decode: Session data decoding.
session_encode: Session data encoding.
There is also a global variable: $_SESSION
Before you can store user information in a PHP session, you must first start the session.
Note: The session_start() function must be placed before the tag: