PHPsession_encode () and session_decode (). This article introduces PHPsession_encode () and session_decode () usage. For more information, see this example. Session_encodesession_encode encodes the current session data into this article to introduce the usage of PHP session_encode () and session_decode (). For details, refer to this example.
Session_encode
Session_encode-encode the current session data into a string
Description
String session_encode (void)
Session_encode () returns a string containing the encoded current session data.
| The code is as follows: |
|
|
// Boolean session_encode ()
Session_register ('bgcolor ');
Session_register ('fontcolor ');
$ Id = session_id ($ usr_id );
$ Bgcolor = "white ";
$ Fontcolor = "blue ";
$ Usr_data = session_encode ();
Print $ usr_data;
?> |
Session_decode
| The code is as follows: |
|
|
Session_start ();
$ _ SESSION = array ();
Session_decode ("products | a: 2: {I: 0; s: 8:" Hal 2000 "; I: 1; s: 6:" Tardis ";}");
Foreach ($ _ SESSION ['products'] as $ p ){
Print "$ p
N ";
}
?> |
Session_encode () and session_decode () usage. For more information, see this instance. Session_encode encodes the current session data...