In this lesson our instructor talks about destroying session. First, he discusses destroying sessions, session_destroy(), an deleting session cookies. Then he talks about garbage collection and a review of the steps. He ends the lesson with nine helpful homework challenges.
When either the client or server determines that a session is to be ended, a session is destroyed. This
cut the link between any previous & any future HTTP transactions
get rid of transient session data that is no longer needed
session_destroy() is used to destroy a session. It ensures that any session data stored on the
server will be deleted.
To properly destroy a PHP session, the following steps must be taken:
Call session_start() to continue the session
Explicitly delete any session data stored in $_SESSION
Explicitly delete the session cookie
Destroy the session data on the server using session_destroy()
To explicitly destroy a session cookie, the functions session_name() and
session_get_cookie_params() are useful.
After a specified amount of time, and regardless of the expiration of a session’s cookie, a
session’s data file will be considered as expired, or a garbage, by PHP.
PHP has a garbage collector process that will periodically run to remove any session data files that
have been marked as garbage. There are several configuration directives in 'php.ini' related to session garbage
Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.