我有這個PHP開關:PHP開關()不工作
<?php
$destination = isset($_GET['act']);
switch ($destination) {
default:
echo "test";
break;
case "manage":
echo "manage things";
break;
case "create":
echo "create things";
break;
}
?>
然而,當我去test.php?act=create
,輸出manage things
不create things
....當我去到test.php?act=manage
- 當然我得到manage things
...
那麼......我該如何解決這個問題?謝謝
嘗試把你的'默認:'末代替在開始時。 –
@ Fred-ii-那沒用。 – nn2
我的錯誤。那麼這項工作下面有很多好的答案。我嘗試了其中的大部分。 –