请帮助我的代码我不明白哪里是事先错误PHP如果{} elseif的{}否则{}语法错误
$userrole = $row['type'];
if ($userrole = "admin") {
$_SESSION['name'] = $row['name'];
header("Location: ../index.php");
} elseif ($userrole = "encoder") {
$_SESSION['name'] = $row['name'];
header("Location: ../mencode.php");
} elseif ($userrole = "verifier") {
$_SESSION['name'] = $row['name'];
header("Location: ../mverify.php");
} else ($userrole = "approver") {
$_SESSION['name'] = $row['name'];
header("Location: ../mapproved.php"); }
日Thnx
'else'不符合条件。另外,单个'='是赋值;如果您想比较两个值是否相等,请使用'=='或'==='。 – Ryan
另请参阅[The 3 different equals](http://stackoverflow.com/questions/2063480/the-3-different-equals) –
你的错误是什么? – chris85