count_sentences [计算句数],示例:{$smarty.get.name|count_sentences}
count_words [计算词数],示例:{$smarty.get.name|count_words}
date_format [时间格式],示例:{$smarty.server.request_time|date_format:"%Y-%m-%d %H:%M:%S"}或者{$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"},显示格式如:2012-7-31 11:01:21
default [默认],示例:{$smarty.get.name|default:'phpernote.com'},意思是当没有接受到name参数或者接收到的name参数值为空的时候,使用phpernote.com代替这个值。
escape [转码],示例:{$smarty.get.name|escape:'url'} ?
indent [缩进],示例:{$smarty.get.name|indent:10:' '},段落首行缩进,这里示例是缩进了十个空格表示的字符。作用类似于css里面的text-indent。
lower [小写],示例:{$smarty.get.name|lower}
upper [大写],示例:{$smarty.get.name|upper}
nl2br [将变量中的\n(换行符)替换成<br />],示例:{$smarty.get.name|nl2br}
regex_replace [正则替换],示例:{$smarty.get.name|replace:"/[\r\t\n]/":"phpernote.com"},将变量中的符合正则的内容替换成指定内容
replace [替换],示例:{$smarty.get.name|replace:"baidu.com":"phpernote.com"},将变量中要求的内容替换成指定内容,示例的意思是将变量中所有baidu.com替换为phpernote.com。
spacify [插空],示例:{$smarty.get.name|spacify:"^^"},将变量字符与字符之间插入指定内容,包括空格。
string_format [字符串格式化] 示例:{$smarty.get.namestring_format:"%d"},该操作是将变量中的内容格式化,格式化参数类同PHP的printf。
strip [去除(多余空格)],示例:{$smarty.get.name|strip:"&nbsp;"},如果存在第一个参数的话,则将空格替换为指定的内容,示例的意思是将空格都替换为"&nbsp;";
 
strip_tags [去除html标签],示例:{$smarty.get.name|strip_tags}
truncate [截取],示例:{$smarty.get.name|truncate:10:'...'},示例的意思是截取10个字符,超出的部分用"..."代替,第二个参数为空的话,超出部分就直接省略了。
wordwrap [行宽约束],示例:{$smarty.get.name|wordwrap:30:"\n":true},将超过指定的长度的内容强制换行
posted on 2017-12-30 17:38  半只毛毛虫  阅读(173)  评论(0编辑  收藏  举报