How smarty template determines that an array is empty
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
1
2
3
|
{if $array|@count neq 0 }
// array is empty
{/if}
|
1
2
3
|
{if $array|@count neq 0 }
1
2
3
|
{ if $array neq ""}
//array is empty
{/if}
|
// array is empty
{/if}
|
2. Direct judgment
1
2
3
|
{ if $array neq ""}
//array is empty{/if}
|
http://www.bkjia.com/PHPjc/1014277.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1014277.htmlTechArticleSmarty template’s method of judging whether an array is empty. Here are two main methods: 1. Use count to get the lower part of the array. In the following example, if $array is empty, no data will be output 1 2...