This commit is contained in:
thinkphp
2016-02-23 12:28:25 +08:00
parent 2dfd60d416
commit 77004dec4b

View File

@@ -109,7 +109,7 @@ class Session
*/ */
public static function set($name, $value = '', $prefix = null) public static function set($name, $value = '', $prefix = null)
{ {
!self::$active) && self::init(); !self::$active && self::init();
$prefix = !is_null($prefix) ? $prefix : self::$prefix; $prefix = !is_null($prefix) ? $prefix : self::$prefix;
if (strpos($name, '.')) { if (strpos($name, '.')) {
// 二维数组赋值 // 二维数组赋值
@@ -134,7 +134,7 @@ class Session
*/ */
public static function get($name = '', $prefix = null) public static function get($name = '', $prefix = null)
{ {
!self::$active) && self::init(); !self::$active && self::init();
$prefix = !is_null($prefix) ? $prefix : self::$prefix; $prefix = !is_null($prefix) ? $prefix : self::$prefix;
if ('' == $name) { if ('' == $name) {
// 获取全部的session // 获取全部的session
@@ -166,7 +166,7 @@ class Session
*/ */
public static function delete($name, $prefix = null) public static function delete($name, $prefix = null)
{ {
!self::$active) && self::init(); !self::$active && self::init();
$prefix = !is_null($prefix) ? $prefix : self::$prefix; $prefix = !is_null($prefix) ? $prefix : self::$prefix;
if (strpos($name, '.')) { if (strpos($name, '.')) {
list($name1, $name2) = explode('.', $name); list($name1, $name2) = explode('.', $name);
@@ -191,7 +191,7 @@ class Session
*/ */
public static function clear($prefix = null) public static function clear($prefix = null)
{ {
!self::$active) && self::init(); !self::$active && self::init();
$prefix = !is_null($prefix) ? $prefix : self::$prefix; $prefix = !is_null($prefix) ? $prefix : self::$prefix;
if ($prefix) { if ($prefix) {
unset($_SESSION[$prefix]); unset($_SESSION[$prefix]);
@@ -209,9 +209,7 @@ class Session
*/ */
public static function has($name, $prefix = null) public static function has($name, $prefix = null)
{ {
if (!self::$active) { !self::$active && self::init();
self::init();
}
$prefix = !is_null($prefix) ? $prefix : self::$prefix; $prefix = !is_null($prefix) ? $prefix : self::$prefix;
if (strpos($name, '.')) { if (strpos($name, '.')) {
// 支持数组 // 支持数组