【问题标题】:php smarty if else loops not workingphp smarty if else 循环不起作用
【发布时间】:2015-03-17 05:48:05
【问题描述】:

基本上我会为我的数组添加一些 if elses。

{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}

这不能正常工作。那么可能是什么问题呢?

【问题讨论】:

  • 告诉我们问题。 “工作不正常”是什么意思?

标签: php mysql arrays smarty


【解决方案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}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-23
    • 1970-01-01
    • 2021-11-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多