smarty模板内赋值(设置变量)

{* do this somewhere at the top of your template *}
{assign var="title" value=$title|default:"no title"}

{* if $title was empty, it now contains the value "no title" when you print it *}
{$title}

详情搜索smarty手册中
Default Variable Handling 

猜你喜欢

转载自qianxunniao.iteye.com/blog/1503283