There are two ways to determine whether an array is empty in smarty templates. Below are examples.
(1) Use php count function
{if $array|@count gt 0}
... ...
{/if}
Copy after login
(2) This way of writing is very strange. Today I searched online because the first method didn’t work, and I found the following strange way of writing.
{if count($array) gt 0}
... ...
{/if}
Copy after login
Articles you may be interested in
- The last record of judging volist loop in thinkphp template
- How to generate random numbers in smarty template
- How to use php functions in smarty templates and how to use multiple functions for one variable in smarty templates
- Insufficient td for circular tables in smarty templates
- Add the latest tags to information in smarty templates
- Extension plug-in for for loop in smarty template
- How to determine whether there are duplicate values in an array in js
- How to use constants defined by define in the program in smarty template
http://www.bkjia.com/PHPjc/764118.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/764118.htmlTechArticleThere are two ways to determine whether an array is empty in smarty templates. Below are examples. (1) Use the php count function {if $array|@count gt 0}... ...{/if} (2) This writing method is very strange,...