Location: PHPKode > projects > Breeze CMS - A PHP Content Manage System > libs/Ice/Session.class.php
<?php
class Ice_Session
{
    /**
     * 构造函数
     *
     * @return void
     */
    function Ice_Session()
    {
        session_start();
        if (@function_exists('session_cache_limiter'))
        {
            session_cache_limiter("private, must-revalidate");
        }
    }

    /**
     * 设置Session值
     *
     * @param string $key
     * @param mixed $value
     */
    function setValue($key, $value)
    {
        $session = Ice_Request::getSession();
        $session[$key] = $value;
        Ice_Ice_Request::setSession($session);
    }
    
    /**
     * 取得指定Session名的值
     *
     * @param string $name
     * @return mixed
     */
    function getValue($key)
    {
        $session = Ice_Request::getSession();
        if (isset($session[$key]))
        {
            return $session[$key];
        }
        
        return null;
    }
    
    /**
     * 删除指定Session名的值
     *
     * @param string $name
     * @return boolean
     */
	function delValue($key)
	{
	    $session = Ice_Request::getSession();
	    if (isset($session[$key]))
	    {
	        $session[$key] = '';
	        unset($session[$key]);
	    }
	    Ice_Request::setSession($session);
	    
        return true;
	}

    /**
     * 清除Session
     */
    function clean()
    {
        $session = Ice_Request::getSession();
        foreach ($session AS $key=>$value)
        {
            unset($session[$key]);
        }
        Ice_Request::setSession($session);
    }
}
Return current item: Breeze CMS - A PHP Content Manage System