PHP Smarty条件-如果Y或如果Y条件


PHP Smarty condition - if Y or if Y condition

我有两个变量,要么传递回N或Y,但只想显示一些东西,要么其中一个被设置为Y,但我认为我做错了。什么好主意吗?

{if $product.bean_bag_filling_150 == "Y" || $product.bean_bag_filling_300 == "Y"}

我假设如果其中至少有一个值为"Y",那么将显示该条件中的内容?

试试这个:

{if (strtolower($product.bean_bag_filling_150) == "y" || strtolower($product.bean_bag_filling_300) == "y")}

阅读:http://php.net/manual/en/function.strtolower.php