1 / 5

PHP Sessions

PHP Sessions. A PHP session variable is used 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. PHP Sessions. session_start()

iparker
Download Presentation

PHP Sessions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PHP Sessions • A PHP session variable is used 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.

  2. PHP Sessions • session_start() • Before you can store user information in your PHP session, you must first start up the session. • The session_start() function must appear BEFORE the <html> tag

  3. PHP Sessions • $_SESSION['views']=1; • if(isset($_SESSION['views']))$_SESSION['views']=$_SESSION['views']+1;else$_SESSION['views']=1;echo "Views=". $_SESSION['views'];

  4. PHP Sessions • unset($_SESSION['views']); • The unset() function is used to free the specified session variable • session_destroy(); • session_destroy() will reset your session and you will lose all your stored session data.

More Related