我无法在任何地方找到答案,这是一个新的错误。有人可以帮我说这句话:
<?php
if ($db_ownrPlan == 'sell in a year or so' || 'get some info only no plans made yet'){
echo "$TYmessage";
} elseif ($db_ownrPlan == 'sell soon' || 'sell in 3 to 6 months' || 'looking to buy this property'){
echo "$TYmessage1";
} else {
echo "$TYmessage2";
}
?>
答案 0 :(得分:2)
if (in_array($db_ownrPlan,
array('sell in a year or so', 'get some info only no plans made yet')))
等紧凑形式(没有检查速度)......
答案 1 :(得分:1)
正确的语法是:
($db_ownrPlan == 'sell in a year or so' || $db_ownrPlan =='get some info only no plans made yet')
否则第二个条件只是字符串而不是比较。
答案 2 :(得分:0)
这是你想要做的:
<?php
if ($db_ownrPlan == 'sell in a year or so' || $db_ownrPlan == 'get some info only no plans made yet'){
echo "$TYmessage";
} elseif ($db_ownrPlan == 'sell soon' || $db_ownrPlan == 'sell in 3 to 6 months' || $db_ownrPlan == 'looking to buy this property'){
echo "$TYmessage1";
} else {
echo "$TYmessage2";
}
?>
在PHP和其他大多数语法相似的编程语言中,你可以比较这样的变量:
VAR == value OR VAR == otherValue