count 返回数组(或可计数对象)中元素的数量。如果为 null,将返回 0。对于任何其他类型(如字符串),将返回 1。 如果可选模式参数设置为 1,count() 将递归计算数组。这对于计算多维数组的所有元素特别有用。 基本用法 {if $myVar|count > 3}4 or more{/if} {if count($myVar) > 3}4 or more{/if} 参数 参数 类型 必需 描述 1 int 否 如果设置为 1,count() 将递归计算数组。