嗨,我不知道我可能会做错什么。我有两个条件返回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