Beispiel #1
0
 /**
  * @return Session
  */
 public static function singleton()
 {
     if (self::$instance === null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Beispiel #2
0
 /**
  * 初始化session环境
  *
  * @return bool
  */
 public static function init()
 {
     if (self::$start) {
         return true;
     }
     /**@type \handler\ISessionHandler $session*/
     $session = App::getConfig()->getSessionHandler();
     if (!$session->isDisabled()) {
         session_set_save_handler(array($session, 'open'), array($session, 'close'), array($session, 'read'), array($session, 'write'), array($session, 'destroy'), array($session, 'gc'));
     }
     session_name('XSSSESSID');
     session_start();
     self::$start = true;
     return true;
 }