Home > php教程 > php手册 > body text

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

WBOY
Release: 2016-06-13 09:12:04
Original
1019 people have browsed it

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;>
Copy after login

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!