选择语言 :

 Module_Session::get

获取一个SESSION数据

Session::instance()->get('key');

Session::instance()->get('key','default value');
mixed Module_Session::get( [ string $key = bool false , mixed $default = bool false ] )

参数列表

参数 类型 描述 默认值
$key string Variable key bool false
$default mixed Default value returned if variable does not exist bool false
返回值
  • mixed Variable data if key specified, otherwise array containing all session data.
File: ./modules/session/session.class.php
public function get($key = false, $default = false)
{
    if (empty($key))return $_SESSION;

    $result = isset($_SESSION[$key]) ? $_SESSION[$key] : Core::key_string($_SESSION, $key);

    return (null===$result) ? $default : $result;
}