smarty变量调节和应用 18.5.2

 

 cat 连接字符串

 

  <{$var|upper|cat:"test is a aa <br>"|cat:"hello word <br>"}> 

 

 $var 大写并且后面加上  "test is a aa  hello word "字符串

 

 date_format  格式化日期

 <{$smarty.now|date_format:"%H-%y-%d  "}> <br>  

当前时间 年月日

 

regex_replace 正则替换

<{$var|regex_replace:"/\d/":"#"}> <br>

$var 中所有数字换成#

 

truncate截取

  <{$var|truncate:30:"..."}> <br>  

截取 $var 30个字符串 后面写...

 

posted @ 2016-08-28 09:11  6月6日暗  阅读(125)  评论(0编辑  收藏  举报