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