<?php
require_once '../include.php';
$admin_username=$_POST['username'];
$admin_userpassword=$_POST['password'];
$sql="select * from adminuserinfo where admin_userName='{$admin_username}' and admin_userPassword='{$admin_userpassword}'";
$row=fetchonce($sql);
if($row)
{
$_SESSION['username']=$row['admin_userName'];
$_SESSION['userid']=$row['admin_userID'];
var_dump($_SESSION['userid']);
var_dump($_SESSION['username']);die();
alert("登录成功","../admin/index.php");
}
else
{
alert("登录失败","../admin/login.php");
}
?>这个可以输出session中的值
<?php
function checkloging(){
var_dump($_SESSION['userid']);
var_dump($_SESSION['username']);die();
if(@$_SESSION['userid']=="")
{
alert("请您先登录","login.php");
}
}这个输出的结果是NULL
session_start();
我加了session_start();返回的还是NULL