Heim >php教程 >php手册 >smarty模板中判断数组为空的方法

smarty模板中判断数组为空的方法

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-06 20:10:131642Durchsuche

在smarty模板中判断数组是否为空有两种方法,下面一一举例分享。 (1)使用php count函数 {if $array|@count gt 0} {/if} (2)这个写法很奇怪,今天是因为第一种方法不行了才在网上找找看,就找到下面这种奇怪的写法了。 {if count($array) gt 0} {/if} 原

在smarty模板中判断数组是否为空有两种方法,下面一一举例分享。

(1)使用php count函数

{if $array|@count gt 0}
… …
{/if}

(2)这个写法很奇怪,今天是因为第一种方法不行了才在网上找找看,就找到下面这种奇怪的写法了。

{if count($array) gt 0}
… …
{/if}

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn