To store information about, or change settings for a user session. Session variables hold information about one single user, and are available to all pages in one application.
----------------------------------------------------------------------------------------------------------------------------------
Starting a PHP Session
*NOTE: The session_start() function must appear BEFORE the html tag:
Storing a Session Variable
############################################################
The Output: Pageviews=1
############################################################
In the example below, we create a simple page-views counter. The isset() function checks if the "views" variable has already been set. If "views" has been set, we can increment our counter. If "views" doesn't exist, we create a "views" variable, and set it to 1:
Destroying a Session
If you wish to delete some session data, you can use the unset() or the session_destroy() function.
The unset() function is used to free the specified session variable:
Or you can also COMPLETELY destroy the session by calling the session_destroy() function:
*NOTE: session_destroy() will reset your session and you will lose all your stored session data.
.jpg)


0 comments:
Post a Comment