mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 20:52:48 +08:00
改进Session类
This commit is contained in:
@@ -109,9 +109,7 @@ class Session
|
||||
*/
|
||||
public static function set($name, $value = '', $prefix = null)
|
||||
{
|
||||
if (!self::$active) {
|
||||
self::init();
|
||||
}
|
||||
!self::$active) && self::init();
|
||||
$prefix = !is_null($prefix) ? $prefix : self::$prefix;
|
||||
if (strpos($name, '.')) {
|
||||
// 二维数组赋值
|
||||
@@ -136,9 +134,7 @@ class Session
|
||||
*/
|
||||
public static function get($name = '', $prefix = null)
|
||||
{
|
||||
if (!self::$active) {
|
||||
self::init();
|
||||
}
|
||||
!self::$active) && self::init();
|
||||
$prefix = !is_null($prefix) ? $prefix : self::$prefix;
|
||||
if ('' == $name) {
|
||||
// 获取全部的session
|
||||
@@ -170,6 +166,7 @@ class Session
|
||||
*/
|
||||
public static function delete($name, $prefix = null)
|
||||
{
|
||||
!self::$active) && self::init();
|
||||
$prefix = !is_null($prefix) ? $prefix : self::$prefix;
|
||||
if (strpos($name, '.')) {
|
||||
list($name1, $name2) = explode('.', $name);
|
||||
@@ -194,6 +191,7 @@ class Session
|
||||
*/
|
||||
public static function clear($prefix = null)
|
||||
{
|
||||
!self::$active) && self::init();
|
||||
$prefix = !is_null($prefix) ? $prefix : self::$prefix;
|
||||
if ($prefix) {
|
||||
unset($_SESSION[$prefix]);
|
||||
|
||||
Reference in New Issue
Block a user