Several complementary functions of the session. Several complementary functions of the session are discussed much in PHP. In fact, we have not noticed several functions in PHP4. I will introduce them to you as some complementary functions of the session.
In PHP, there are a lot of discussions about Sessions. In fact, there are still several functions in PHP4 that we have not noticed at ordinary times.
Let me introduce them to you.
Session_set_save_handler () is really a good thing.
//********************
Session_unset (PHP4> = 4.0b4)
Void session_unset (void );
This function can leave all session variables registered to null. Note that it is neither unregister nor destroy.
In the following example, this function is well described.
Session_register ("a", "B", "c"); // auto-session-start
$ A = 1;
$ B = 2;
$ C = 3;
Session_unregister ("a"); // unregistrered $
Echo "A: $ a-reg:". session_is_registered ("")."
"; // But the global $ a remains
Session_unset (); // unsets $ B und $ c
Echo "B: $ B-reg:". session_is_registered ("B ")."
"; // The registration remains!
Echo "C: $ c-reg:". session_is_registered ("c ")."
";
Echo session_encode ();
?>
Output:
A: 1-reg:
B:-reg: 1
C:-reg: 1
! B |! C |
//********************************
Session_get_cookie_params (PHP4> = 4.0RC2)
Array session_get_cookie_params (void );
Returns an array that records the cookie information of the current session.
Include:
"Lifetime"-the lifetime of the cookie.
"Path"-cookie storage path.
"Domain"-cookie domain.
//*******************************
Session_set_cookie_params (PHP4> = 4.0b4)
Void session_set_cookie_params (int lifetime [, string path] [, string domain])
This function only applies to the current script file.
//*******************************
The function to be introduced below should be very useful to everyone. are you interested in customizing a session to save without cookies? This function can achieve your assumption.
Let me think about the benefits of using cookies? At least, you don't have to worry about whether the client's cookie function is enabled, right.
Pipeline has a lot of discussions about Sessions in PHP. In fact, we have not noticed several functions in PHP4. Let me introduce them to you now...