Its prototype looks like this:
void session_unset()
While executing session_unset() will indeed delete all session variables stored in
the current session, it will not completely remove the session from the storage mechanism.
If you want to completely destroy the session, you need to use the function
session_destroy(), which invalidates the current session by completely removing the
session from the storage mechanism. Keep in mind that this will not destroy any
cookies on the user??™s browser. Its prototype looks like this:
boolean session_destroy()
If you are not interested in using the cookie beyond the end of the session, just set
session.cookie_lifetime to 0 (its default value) in the php.ini file.
Setting and Retrieving the Session ID
Remember that the SID ties all session data to a particular user. Although PHP will
both create and propagate the SID autonomously, there are times when you may
wish to manually set or retrieve it. The function session_id() is capable of carrying
out both tasks. Its prototype looks like this:
string session_id([string sid])
CHAPTER 18 ?– SESSION HANDLERS 455
The function session_id() can both set and get the SID. If it is passed no parameter,
the function session_id() returns the current SID. If the optional sid parameter is
included, the current SID will be replaced with that value. An example follows:
session_start();
echo "Your session identification number is ".
Pages:
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536