解决方案 »
- php hash 数组问题!!
- GoogChart在PHP中图表制作怎么样设置,请高手回复。。。。。
- 关于nl2br的问题!看见速度进!
- 请问有没有基于Web(PHP)的SVN应用?
- 求一篇PHP语言的实验设备管理系统的论文+源代码
- PHP能够跨目录修改文件吗?
- 使用PHPMailer报错
- <? ?> 和 <?php ?> 的区别
- AJAX PHP 循环之后点击状态更换图片
- 网页开发应该用哪种语言?
- 我安装了nginx1.1.12和php5.3.5但是有phpinfo查看时,发现没有加载配置文件php.ini,实际上我这配置文件是存在信息显示的路径里面。
- 勾选批量执行代码无效,。请问问题在哪?
session_start();
$stu=new Model('Priminfo');
if($stu->create()){
$stuid=$stu->stuid;
$pwd=md5($stu->pwd);
$list=$stu->where("stuid='$stuid' and pwd='$pwd'")->field('stuid,pwd')->find();
if($list!==NULL && $list!==''){
session('stuid',$stuid);
echo session('stuid');
echo '<script language="javascript">alert("登陆成功");window.location.href="index"</script>';
}else{
echo '<script language="javascript">alert("登陆失败");window.location.href="login"</script>';
}
}else{
echo '<script language="javascript">alert("创建数据失败");window.location.href="login"</script>';
}
}
这是对登陆用户信息的check方法logincheck public function index(){
session_start();
if(session('?stuid')){
$this->assign('title','暨南大学深圳旅游学院学生信息管理系统');
$this->display();
}else{
//$this->redirect('login',5,'页面跳转中');
echo '<script language="javascript">alert("不存在session stuid的值");window.location.href="login"</script>';
}
}
这是登陆check成功后跳转到index方法中,但是session值就被清空了
在logincheck中的这段代码还是可以打印出session的值的,也是弹出登陆成功,但是当跳转到index方法的时候就弹出“不存在session stuid的值”的对话框。注释掉session_start也是不行的哦
所以肯定是环境的问题.. 但是就是找不到问题...
session过了页面就丢失了. 在同一个action下面的两个方法都拿不到
也用的是tp提供的session方法