PHP Sessions Test script
Add the following script to your test.php page and keep refreshing the page in browser, this will show you the working of session. The session variable "count" is getting incremented with each refresh.
Code:
<?php
session_start();
// Use $HTTP_SESSION_VARS with PHP 4.0.6 or less
if (!isset($_SESSION['count'])) {
$_SESSION['count'] = 0;
} else {
$_SESSION['count']++;
}
echo "Count: =$count";
?>
|