经测试代码如下:
/**
* 常用session操作,包含读取,写入,销毁
*
* @param
* @arrange (512.笔记) jb51.cc
**/
class Session
{
function Session()
{
session_start();
}
function set($name,$value)
{
$_SESSION[$name] = $value;
}
function get($name)
{
if(isset($_SESSION[$name]))
return $_SESSION[$name];
else
return false;
}
function del($name)
{
unset($_SESSION[$name]);
}
function destroy()
{
$_SESSION = array();
session_destroy();
}
function save_prefs()
{
global $db,$auth;
$prefs = serialize($this->prefs);
$db->query("UPDATE condra_users SET prefs = '$prefs' WHERE id = '{$auth->id}'");
}
}
/*** 来自编程之家 jb51.cc(jb51.cc) ***/
原文链接:https://www.f2er.com/php/528899.html