【发布时间】:2014-10-31 05:41:32
【问题描述】:
我知道这又是同一个问题,但是我尝试了所有方法并排除了故障,但不明白为什么在这种情况下我会出错
提前致谢
loginpage.php
<?php
include('crud.php');
// code
if($_POST['login']=='ok'){
$r=base::login($_POST);
if($r==true)
{
var_dump($_SESSION['login']); // here I am getting the session it on the same page
header("location: index.php");
die();
}
else
{
$msg="Username or Password is Incorrect";
}
}
// code
?>
index.php
<?php
include('crud.php');
// code
var_dump($_SESSION['login']); // here its lost
// code
?>
crud.php
<?php
@ob_start();
@session_start();
ini_set('error_reporting',1);
// db call
// other functions
$_SESSION['login']=$sql->id; // here session is created
return is_numeric($sql->id)? true :false;
?>
【问题讨论】:
-
您遇到了什么错误?
标签: php session session-variables session-cookies