有两种方法可以得到用户的session id,第一是使用session_id()函数,另外一种是使用内置的常量SID获得,SID包含了session id和session值
/**
* PHP查看当前Session的ID
*
* @param
* @arrange 512-笔记网: jb51.cc
**/
<?PHP
session_start();
print("<html><b>");
$sid = session_id();
print("Session ID returned by session_id(): ".$sid."\n");
$sid = SID;
print("Session ID returned by SID: ".$sid."\n");
$mysite = $_SESSION["mysite"];
print("Value of mysite has been retrieved: ".$mysite."\n");
print("</b></html>\n");
?>
/*** 来自编程之家 jb51.cc(jb51.cc) ***/