我有兩個變量,要麼返回N或Y,但只想顯示或者其中一個設置爲Y,但認爲我做錯了。有任何想法嗎?PHP Smarty的條件 - 如果Y或如果Y條件
{if $product.bean_bag_filling_150 == "Y" || $product.bean_bag_filling_300 == "Y"}
我假設如果其中至少有一個值爲「Y」,將顯示該條件內的內容?
我有兩個變量,要麼返回N或Y,但只想顯示或者其中一個設置爲Y,但認爲我做錯了。有任何想法嗎?PHP Smarty的條件 - 如果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")}
括號? '如果($ product.bean_bag_filling_150 ==「Y」|| $ product.bean_bag_filling_300 ==「Y」)' – Berriel
我剛剛嘗試過,但只顯示如果兩者都設置爲「Y」,如果一個設置爲「Y」和其他「n」不會顯示...我需要顯示,如果其中任何一個被設置爲「y」 – James
'「Y」!=「y」'。發佈可能對你有幫助的答案。 – Berriel