$type = trim(strip_tags(stripslashes($_GET['type'])));
$referer = $_SERVER["HTTP_REFERER"];
if ($type == "Clinical" && $referer == "al.php?zh=loadPage") {
echo "clinical";
}
elseif ($type == "AnnualEducation" && referer == "ual.php?zh=loadPage") {
echo "annual";
}
else {
echo "neither";
}
我遇到的问题是,如果类型为Clinical
和al.php?zh=loadpage
,那么IF会触发(这是正确的)但是当类型为AnnualEducation
和ual.php?zh=loadpage
时ELSE开火了。不知怎的,正在跳过elseif。
有什么想法解决它?
答案 0 :(得分:6)
在elseif
elseif ($type == "AnnualEducation" && referer == "ual.php?zh=loadPage") {
应该是
elseif ($type == "AnnualEducation" && $referer == "ual.php?zh=loadPage") {
{1}}
中缺少$