Smarty常用的20个变量操作符实例

来源:互联网 发布:在奥地利生活 知乎 编辑:程序博客网 时间:2024/05/19 20:39
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>{$title}</title></head><body>{section name=list loop=$content}{$content[list].title}--{$content[list].content}{/section}原始内容:{$word}<br>之后的内容:{$word|capitalize}<br>字符的数目:{$word|count_characters}<br>连接的使用:{$word|cat:"--我的名字叫程欢"}<br>计算词数:{$word|count_words}<br>转义之后的内容:{$word|escape}<br>原始时间:{$time}格式化后的时间:{$time|date_format}<br>缩进之后:{$word|indent:10:' '}<br>替换之后:{$word|replace:"one":"******"}<br>插孔之后:{$word|spacify:"#"}原始内容:{$xiaoshu}</br>格式化之后:{$xiaoshu|string_format:'%d'}<br>去除多余空格之后:{$word|strip:'|'}<br>去除多余的标签:{$word|strip_tags}<br>街区多余的字符串:{$word|truncate:15:"....."}</body></html>