示例#1
0
 public function initSession()
 {
     $config = App::conf('app', 'session', array());
     $session = new Session();
     if (isset($config['type'])) {
         switch ($config['type']) {
             case 'file':
                 if (!empty($config['file']['save_path'])) {
                     $session->setSavePath($config['file']['save_path']);
                 }
                 break;
             case 'memcached':
                 $session->setHandler(new Memcached($config['memcached']['servers']));
                 break;
         }
     }
     $session->start();
     return $session;
 }
示例#2
0
 public function who()
 {
     if ($this->check()) {
         return Session::pull('authentication')['key'];
     }
     return false;
 }