http://blog.csdn.net/wyhuan1030/article/details/6289321
smarty本身逻辑导致的问题,如果使用以下代码: <{foreach from=$array item=one}> <li><{$one.title}></li> <{/foreach}> 即使$array为空还是会执行一次。 如果想要解决这个问题,只能使用下面的办法 <{if $array}> <{foreach from=$array item=one}> <li><{$one.title}></li> <{/foreach}> <{/if}> 或者 <{if is_array($array)}> <{foreach from=$array item=one}> <li><{$one.title}></li> <{/foreach}> <{/if}>