php smarty if else循环不起作用

时间:2015-03-17 05:48:05

标签: php mysql arrays smarty

基本上我正在为我的阵列添加一些if else。

{if $array| count eq 0 || $array| count lt 10}
    <p>equal to 0, less than 10</p> 
{/if}
{if $array| count gte, ge 10}
    <p>greater than or equal to 10</p>
{else}
    <p>blah</p>
{/if}

哪个不行。那可能是什么问题?

1 个答案:

答案 0 :(得分:1)

这是怎么回事。你可以使用gte或ge,但不能同时使用两者。

{if $array| count lt 10}
 <p>equal to 0, less than 10</p> 
{/if}
{if $array| count ge 10}
 <p>greater than or equal to 10</p>
{else}
 <p>blah</p>
{/if}