ITeye博客

laravel 自定义 检查 session 数据是否存在

ww111 · 2016-03-03 18:05 · linux php · 项目 开源 · 互联网 · Markdown

// vendor/laravel/framework/src/Illuminate/Session/Store.php
// 添加下面方法,然后在需要的地方,Session::hasSession()
     public function hasSession(){
         return $this->handler->read($this->getId()) ? true : false;
     }

//
 public function resetId($id)
    {
        $this->flush();
        $this->id = $id;
        if($this->hasSession()){
            $this->loadSession();
        }
   }

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。