Every PHP beginner may encounter the same problem when using SESSION, that is, Warning: open (/tmp/sess_7a8c81039d7cba3f9a868bc90f821526, O_RDWR) failed: m (2) inYOUR_PHP_FILE_PATHsession.phponline2 this is not your PHP version
Every PHP beginner may encounter the same problem when using SESSION, that is
Warning: open (/tmp/sess_7a8c81039d7cba3f9a868bc90f821526, O_RDWR) failed: m (2) in YOUR_PHP_FILE_PATHsession.php on line 2
This is not because your PHP version is not high enough, not a syntax error, but the path specified by PHP to store SESSION files does not exist. The following describes the usage of the SESSION and some of my first-time experiences. I hope that beginners will take less detours.
The SESSION information of PHP is written on the server's hard disk. by default, it is the/TMP Directory. if this directory is not found on your hard disk, the error information mentioned above will appear, there are two solutions to this problem. one is to create a directory named TMP in the root directory, and the other is to use the session_save_path () function provided by the system to re-specify an existing directory. PHP and ASP process sessions in different ways. ASP writes sessions to the client and uses a special statement to call the SESSION. PHP also needs to initialize an environment for the SESSION. Next I will introduce the PHP SESSION.
Before using SESSION, you must first initialize session_start () and declare the variable using the session_register () function. the format should be session_register ("ssp") or session_register ("$ ssp "), if the statement is declared successfully, a TRUE value is returned. This variable becomes a SESSION and can be called on other pages.
The call method is as follows: you must initialize the SESSION on the call page (same as above), and then you can directly use the variable name,
Session_start: initial session.
Session_destroy: ends the session.
Session_name: name of the current session to be accessed.
Session_module_name: Access the current session module.
Session_save_path: the current session path.
Session_id: Access the current session code.
Session_register: registers a new variable.
Session_unregister: Delete a registered variable.
Session_is_registered: Check whether the variable is registered.
Session_decode: decodes Session data.
Session_encode: Session Data encoding