<?php
class session {
const SESSION_STARTED = TRUE;
const SESSION_NOT_STARTED = FALSE;
private $session_state = self::SESSION_NOT_STARTED;
private static $instance;
public static function get_instance(){
if(!isset(self::$instance)){
self::$instance = new self;
}
self::$instance->start_session();
return self::$instance;
}
public function start_session(){
if($this->session_state == self::SESSION_NOT_STARTED){
$this->session_state = session_start();
}
return $this->session_state;
}
public function __set($name,$value){
$_SESSION[$name] = $value;
}
public function __get($name){
if(isset($_SESSION[$name])){
return $_SESSION[$name];
}
}
public function __isset($name){
return isset($_SESSION[$name]);
}
public function __unsset($name){
unset($_SESSION[$name]);
}
public function destroy(){
if($this->session_state == self::SESSION_STARTED){
$this->session_state = !session_destroy();
unset($_SESSION);
return !$this->session_state;
}
return false;
}
}
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号