本文整理匯總了PHP中UserSession::setSessionInfo方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserSession::setSessionInfo方法的具體用法?PHP UserSession::setSessionInfo怎麽用?PHP UserSession::setSessionInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserSession
的用法示例。
在下文中一共展示了UserSession::setSessionInfo方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: reload
public static function reload()
{
$current_user_info = self::getSessionInfo();
$user_info = User::getUserById($current_user_info['user_id']);
if ($user_info['status'] != 1) {
Common::jumpUrl("login.php");
return;
}
//讀取該用戶所屬用戶組將該組的權限保存在$_SESSION中
$user_group = UserGroup::getGroupById($user_info['user_group']);
$user_info['group_id'] = $user_group['group_id'];
$user_info['user_role'] = $user_group['group_role'];
$user_info['shortcuts_arr'] = explode(',', $user_info['shortcuts']);
$menu = MenuUrl::getMenuByUrl('/admin/setting.php');
if (strpos($user_group['group_role'], $menu['menu_id'])) {
$user_info['setting'] = 1;
}
$user_info['login_time'] = Common::getDateTime($user_info['login_time']);
UserSession::setSessionInfo($user_info);
}
示例2: loginDoSomething
public static function loginDoSomething($user_id)
{
$user_info = User::getUserById($user_id);
if ($user_info['status'] != 1) {
Common::jumpUrl("login.php");
return;
}
//讀取該用戶所屬用戶組將該組的權限保存在$_SESSION中
$user_group = UserGroup::getGroupById($user_info['user_group']);
$user_info['group_id'] = $user_group['group_id'];
$user_info['user_role'] = $user_group['group_role'];
$user_info['shortcuts_arr'] = explode(',', $user_info['shortcuts']);
$menu = MenuUrl::getMenuByUrl('/admin/setting.php');
if (strpos($user_group['group_role'], $menu['menu_id'])) {
$user_info['setting'] = 1;
}
$login_time = time();
$login_ip = Common::getIp();
$update_data = array('login_ip' => $login_ip, 'login_time' => $login_time);
User::updateUser($user_info['user_id'], $update_data);
$user_info['login_ip'] = $login_ip;
$user_info['login_time'] = Common::getDateTime($login_time);
UserSession::setSessionInfo($user_info);
}