标签:Nid root isset ESS use sse pre host png
login.php
<?php
session_start();
$user = $_GET["user"];
$session_ID = session_id();
$_SESSION[$session_ID]=$user;
print $session_ID;
登陆后返回sessionID
http://localhost/login.php?user=root
用户执行一些需要已经在登陆状态的操作
带上sessionID
http://localhost/islogin.php?sessionID=a3dms2f84b55i2pg9r2gffm0v5
我们可以通过sessionID来判断是哪个用户
islogin.php
<?php
session_start();
$session_id = $_GET[‘sessionID‘];
if (isset($_SESSION[$session_id])){
print $_SESSION[$session_id] ;
} else{
print ("未登陆");
}
用户注销时也注销sessionID
loginout.php
<?php
session_start();
session_id = _GET[‘sessionID‘];
session_unset($session_id);
访问loginout后
http://localhost/loginout.php?sessionID=a3dms2f84b55i2pg9r2gffm0v5
再次判断是否登陆
http://localhost/islogin.php?sessionID=a3dms2f84b55i2pg9r2gffm0v5
标签:Nid root isset ESS use sse pre host png
原文地址:https://www.cnblogs.com/hehecat/p/9266611.html