当前位置:Gxlcms > PHP教程 > smarty模板判断数组为空的方法_PHP教程

smarty模板判断数组为空的方法_PHP教程

时间:2021-07-01 10:21:17 帮助过:3人阅读

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


这里主要介绍两种方法:

1. 用count来取得数组的下标个数

下面例子中,如果$array为空则不输出任何数据

1

2

3

{if $array|@count neq 0 }

// array is empty

{/if}

2. 直接判断

1

2

3

{ if $array neq ""}

//array is empty

{/if}

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/1014277.htmlTechArticlesmarty模板判断数组为空的方法 这里主要介绍两种方法: 1. 用count来取得数组的下标个数 下面例子中,如果$array为空则不输出任何数据 1 2...

人气教程排行