Heim  >  Artikel  >  Backend-Entwicklung  >  smarty模板中判断数组为空的方法_PHP教程

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

WBOY
WBOYOriginal
2016-07-13 10:31:161105Durchsuche

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

(1)使用php count函数

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

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

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

您可能感兴趣的文章

  • thinkphp模板中判断volist循环的最后一条记录
  • smarty模板中如何生成随机数
  • smarty模板中使用php函数以及smarty模板中如何对一个变量使用多个函数
  • smarty 模板中循环表格补充不全的td
  • smarty模板中给信息添加最新标签
  • smarty模板中for循环的扩展插件
  • js中判断一个数组中是否有重复值的方法
  • 程序中通过define定义的常量如何在smarty模板中使用

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/764118.htmlTechArticle在smarty模板中判断数组是否为空有两种方法,下面一一举例分享。 (1)使用php count函数 {if $array|@count gt 0}... ...{/if} (2)这个写法很奇怪,...
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