当用户单击登录按钮(index.php)时,我正在调用chechlogin.php,在其中我正在检查 loginId 密码为-
if($count==1)
{
// Register $myusername, $mypassword and redirect to file "login_success.php"
session_register("myusername");
session_register("mypassword");
$_SESSION['UserId'] = $myusername;
$_session['SessionId'] = session_id();
header("location:LoggedUser.php");
}
在LiggedUser.php中
<?php session_start(); //starting session
if (!isset($_SESSION['SessionId']) || $_SESSION['SessionId'] == '') { header("location:index.php"); } ?>
问题:尽管我输入了正确的用户名和密码,但它总是返回 index.php 页面。我认为 session_id() 工作不正常还是?