【发布时间】:2019-01-30 23:06:57
【问题描述】:
我已将数组保留在会话中,如果用户角色是 admin 和其他角色,我想将用户重定向到 admin。但我不能这样做??我不知道问题出在哪里。会话没有正常进行。谁能帮帮我??
$session_user = array($user_id = $row['user_id'],
$fullname = $row['fullname'],
$username = $row['username'],
$phone_number = $row['phone_number'],
$state = $row['state'],
$city = $row['city'],
$street = $row['street'],
$email = $row['email'],
$user_role = $row['user_role']);
$_SESSION['userdata'] = $session_user;
/*header('Location:hello.php');*/
if($_SESSION['userdata']== 'admin'){
/*header('Location:admin/admindashboard.php');*/
header('Location:hello.php');
}else{
/*header('Location:contributor/contributordashboard.php');*/
/*header('Location:hello.php');*/
echo "Error in identifying the user role";
}
【问题讨论】: