Everyone uses sessions alot, and I find it's really annoying to reboot Apache everytime I screw up the $_SESSION array. So I've been using this for a while now:
Code: Select all
<?php
session_start();
if(isset($_GET['kill']))
session_unset();
else
{
$sessPath = ini_get('session.save_path');
$sessCookie = ini_get('session.cookie_path');
echo '<br>sessPath: ' . $sessPath;
echo '<br>sessCookie: ' . $sessCookie;
echo '<br>sessId: ' . session_id();
echo '<hr />';
echo '<br />current session array: '; print_r($_SESSION);
if(isset($_GET['one']))
$_SESSION['test1'] = 'hello1';
else
$_SESSION['test'] = 'hello';
echo '<br />session array after set: '; print_r($_SESSION);
}
?>
<br />
<a href="sessions.php">set test to hello</a><br />
<a href="sessions.php?one">set test1 to hello1</a><br />
<a href="sessions.php?kill">kill session</a>