Home > Backend Development > PHP Tutorial > Smarty template method to determine if the array is empty, smarty template to determine the array_PHP tutorial

Smarty template method to determine if the array is empty, smarty template to determine the array_PHP tutorial

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

The method of smarty template to judge that the array is empty, the smarty template to judge the array

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}

Copy after login

2. Direct judgment

{ if $array neq ""}
//array is empty
{/if}
Copy after login

I hope this article will be helpful to everyone’s PHP programming based on smarty templates.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1014433.htmlTechArticleSmarty template determines the array is empty method, smarty template determines the array The example of this article tells the smart template determines the array is empty method. Share it with everyone for your reference. The details are as follows: This...
Related labels:
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