smarty模板判断数组为空的方法,smarty模板判断数组
本文实例讲述了smarty模板判断数组为空的方法。分享给大家供大家参考。具体如下:
这里主要介绍两种方法:
1. 用count来取得数组的下标个数
下面例子中,如果$array为空则不输出任何数据
{if $array|@count neq 0 }
// array is empty
{/if}
2. 直接判断
{ if $array neq ""}
//array is empty
{/if}
希望本文所述对大家基于smarty模板的php程序设计有所帮助。
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn