嗨,我不知道我可能會做錯什麼。我有兩個條件返回true或false.For同樣的原因它不工作。如果有人指出我可能會做錯什麼,我將不勝感激。PHP if語句?
<?php
$pagetype = strpos($currentPage, 'retail');
if(isset($quoterequest) && $pagetype === True && $currentPage !== 'index.php'){
echo "this is retail" ;
}elseif(isset($quoterequest) && $pagetype === False && $currentPage !== 'index.php'){
echo "this is restaurant";
}
?>
EDIT-對不起,我編輯它,但沒有出現某種原因。基本上腳本眺望網址術語「零售」,如果它發現它,它應該返回「這是散戶」,如果不是「這是餐廳」
quoterequest是就像這樣
$quoterequest = "washington"
和可變當前頁面是從
<?php $currentPage = basename($_SERVER['SCRIPT_NAME']);
只是要清楚。鏈接結構,像這樣
www.example.com/retail-store.php www.example.com/store.php
發生了什麼,你想在這裏發生什麼?它沒有進入你期望的條款,還是沒有進入任何一個? – 2010-08-05 20:05:02
我們可以得到一些$ currentPage和$ quoterequest的價值樣本 – Phliplip 2010-08-05 20:05:22
並且它是否說'這是零售'或'這是餐廳' - 或者都不是? – Phliplip 2010-08-05 20:06:15