Esempio n. 1
0
 /**
  * 移除所有Session数据
  */
 public static function removeAll()
 {
     Base::checkOpen();
     if (Base::driver() == 'file') {
         $_SESSION = [];
         return;
     }
     $data = self::getAll();
     $session = Base::getSessionObject();
     foreach ($data as $index => $value) {
         $session->remove($index);
     }
 }
Esempio n. 2
0
 /**
  * 启动Session并注入到DI
  *
  * @param   \Phalcon\DI\FactoryDefault  $di     Phalcon的DI类
  */
 private function handleSession(&$di)
 {
     if (!QS::isOpen()) {
         return;
     }
     QS::startSession();
     $di->set('session', function () {
         return QS::getSessionObject();
     });
 }