Home >php教程 >php手册 >php查看当前Session的ID实例,当前sessionid实例

php查看当前Session的ID实例,当前sessionid实例

WBOY
WBOYOriginal
2016-06-13 09:12:041041browse

php查看当前Session的ID实例,当前sessionid实例

本文实例讲述了php查看当前Session的ID的方法。分享给大家供大家参考。具体如下:

有两种方法可以得到用户的session id,第一是使用session_id()函数,另外一种是使用内置的常量SID获得,SID包含了session id和session值

<&#63;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");
&#63;>

希望本文所述对大家的php程序设计有所帮助。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn