session_close(): This function operates much like a typical handler function
does, closing any open resources initialized by session_open(). As you can see,
there are no input parameters for this function. Keep in mind that this does not
destroy the session. That is the job of session_destroy(), introduced at the end of
this list.
session_read($sessionID): This function reads the session data from the storage
media. The input parameter $sessionID refers to the SID that will be used to identify
the data stored for this particular client.
session_write($sessionID, $value): This function writes the session data to the
storage media. The input parameter $sessionID is the variable name, and the
input parameter $value is the session data.
session_destroy($sessionID): This function is likely the last function you??™ll call in
your script. It destroys the session and all relevant session variables. The input
parameter $sessionID refers to the SID in the currently open session.
session_garbage_collect($lifetime): This function effectively deletes all sessions
that have expired. The input parameter $lifetime refers to the session configuration
directive session.gc_maxlifetime, found in the php.ini file.
Tying Custom Session Functions into PHP??™s Logic
After you define the six custom handler functions, you must tie them into PHP??™s
session-handling logic. This is accomplished by passing their names into the function
464 CHAPTER 18 ?– SESSION HANDLERS
session_set_save_handler().
Pages:
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545