1 <?
2 //$id=session_id("testsession");
3 //session_start($id);
4 session_start();
5 echo session_id();
6 $_SESSION['name']="test";
7 echo "<br>";
8 print_r($_SESSION);
9 echo "<br>";
10 echo session_name();
11 echo "<br>";
12 $sessionpath = session_save_path();
13 if(strpos($sessionpath,";")!==FALSE){
14 $sessionpath = substr ($sessionpath, strpos ($sessionpath, ";")+1);
15 //获取当前session的保存路径
16 }
17 echo $sessionpath;
18 ?>
test_session.php
1 <?php
2 session_start();
3 echo session_id();
4 echo "<a href=destroy.php>logout</a>";
5 ?>
destroy.php
<?php
session_start();
print_r($_COOKIE);
setcookie(PHPSESSID,"",-1,"/");
#session_regenerate_id();
#echo session_id()
#setcookie("testuser","test",time()+3600);
echo "success";
?>