在Smarty3中,您可以使用PHP的empty()函数:
somefile.php
<?PHP
$smarty->assign('array',array());
$smarty->display('template.tpl');
Run Code Online (Sandbox Code Playgroud)
template.tpl
{if empty($array)}
Array is empty
{else}
Array is not not empty
{/if}
Run Code Online (Sandbox Code Playgroud)
输出Array is empty。