public static function Get() { if (is_null(self::$self)) { $class = __CLASS__; self::$self = new $class(); } return self::$self; }
public function __construct($mem) { self::$mem = $mem; self::$maxtime = ini_get('session.gc_maxlifetime'); session_module_name('user'); //session文件保存方式,这个是必须的!除非在Php.ini文件中设置了 session_set_save_handler(array(__CLASS__, 'open'), array(__CLASS__, 'close'), array(__CLASS__, 'read'), array(__CLASS__, 'write'), array(__CLASS__, 'destroy'), array(__CLASS__, 'gc')); session_start(); //这也是必须的,打开session,必须在session_set_save_handler后面执行 }
private static function _create_session() { self::$_system_session = SystemSession::add($_SESSION); self::$_data_hash = md5(serialize($_SESSION)); setcookie(Config::get('COOKIE_NAME'), self::$_system_session->getSessionId(), time() + 31536000, '/'); }