請幫助我的代碼我不明白哪裏是事先錯誤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