Smarty template method to determine if array is empty_PHP tutorial

WBOY
Release: 2016-07-13 09:51:13
Original
691 people have browsed it

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}

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...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template