[转]smarty判断数组是否为空

如何用smarty判断一个数组为空,这在用smarty模板引擎时会经常用的。
现在总结二种方法,
1,用count来取得数组的下标个数
下面例子中,如果$array为空则不输出任何数据 phperz~com
以下为引用的内容:
{if $array|@count neq 0 }
{/if}


2,直接判断
以下为引用的内容:
{ if $array neq ""}
{/if}

 

smarty逻辑运算符

 

eq        equal : 相等
neq       not equal:不等于
gt        greater than:大于
lt        less than:小于
lte       less than or equal:小于等于
gte       great than or equal:大于等于
is even:是偶数
is odd:是奇数
is not even:不是偶数
is not odd不是奇数
not:非
mod:取余
div by:被。。。除
原文地址:https://www.cnblogs.com/zcy_soft/p/2179761.html