if($row['rank_code'] == 13 or 14)
{
//admin panel
header("location:home_1");
$_SESSION["hname"] = "$hname";
exit();
}
elseif($row['rank_code'] == 7 or 8 or 9 or 10 or 11 or 12)
{
//senior panel
header("location:home_2");
$_SESSION["hname"] = "$hname";
exit();
}
elseif($row['rank_code'] == 0 or 1 or 2 or 3 or 4 or 5 or 6)
{
//junior panel
header("location:home_3");
$_SESSION["hname"] = "$hname";
exit();
}
[我想将标头重定向到home_3,但始终将其重定向到home_1。因为$ row ['rank_code']的值来自mysql数据库,为0 ..
您可以将rank_code值与具有每个dest值的数组进行比较:
$sendAdminPanel = array(13,14);
$sendSeniorPanel = array(7,8,9,10,11);
$sendJuniorPanel = array(0,1,2,3,4,5,6);
if (in_array($row['rank_code'], $sendAdminPanel))
{
// go to admin panel
}
else
{
//..
}