Home >Backend Development >PHP Tutorial >PHP View the ID instance of the current Session, the current sessionid instance_PHP tutorial
The example in this article describes the method of checking the ID of the current Session in php. Share it with everyone for your reference. The details are as follows:
There are two ways to get the user's session id. The first is to use the session_id() function, and the other is to use the built-in constant SID. SID contains the session id and session value
<?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"); ?>
I hope this article will be helpful to everyone’s PHP programming design.