Home  >  Article  >  Backend Development  >  thinkphp的session会话出现问题

thinkphp的session会话出现问题

WBOY
WBOYOriginal
2016-06-20 12:43:411146browse

代码是这样设计的,登陆成功的时候会记录下session['id']。然后在其他页面的时候控制器会先检查用户会话信息,例如
public function _initialize(){
        if(!session('?id') && !session('?account')){
            //没登录
            $this->redirect(GROUP_NAME.'/Login/index');
        }
    }
本地服务器测试没问题,上传到云服务器上就一直执行 $this->redirect(GROUP_NAME.'/Login/index')了。这是怎么回事呢?不知道有没有人遇见过,请求帮助!


回复讨论(解决方案)

那就是 session 变量不存在喽

检查 session.auto_start 的值

@xuzuning 似乎是thinkPHP的问题,已经解决了。感谢您的回答!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:图概PHP生命周期Next article:sql?where