Home >Backend Development >PHP Tutorial >Smarty template method to determine if the array is empty, smarty template to determine the array_PHP tutorial
The example in this article describes the method of smarty template to judge that the array is empty. Share it with everyone for your reference. The details are as follows:
Here are two main methods:
1. Use count to get the number of subscripts in the array
In the following example, if $array is empty, no data will be output
{if $array|@count neq 0 } // array is empty {/if}
2. Direct judgment
{ if $array neq ""} //array is empty {/if}
I hope this article will be helpful to everyone’s PHP programming based on smarty templates.