Home >Backend Development >PHP Tutorial >php查看当前Session的ID实例_PHP

php查看当前Session的ID实例_PHP

WBOY
WBOYOriginal
2016-05-31 11:46:00849browse

本文实例讲述了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