01.php :
<?php
$savepath="./se/";
$lifetime=10*3600;
session_save_path($savepath);
session_set_cookie_params($lifetime);
session_start();
$_SESSION['name']="aaajjj";
echo "name:".$_SESSION['name']."<br>";
$snid=session_id();
echo "snid:".$snid."<br>";
$url="<a href="."\"002.php?s=".$snid."\">next</a>";
echo $url;
?>
02.php :
<?php
session_id($_GET['s']);
$snid01=session_id();
echo"snid01:".$snid01."<br>";
session_start();
$snid02=session_id();
echo"snid02:".$snid02."<br>";
if(isset($_SESSION['name'])){
echo "name:".$_SESSION['name']."<br>";
}else{
echo"close";
}
session_destroy();
?>
01.php 输出:
名:aaajjj SNID:AAAAAAAAA 下
02.php输出:
snid01:AAAAAAAAA snid02:bbbbbbbbb 靠近
pre-session-id已经从\ next&lt; / a&gt;获得,但002.php仍然会创建一个新会话。