PHP模板引擎Smarty应用(3)变量操作符
精选 转载1.什么是Smarty模板引擎中的变量操作符?
变量操作符实际上就是php模板引擎smarty内置的一些操作函数,我们称之为变量操作符,变量操作符可用于操作变量,自定义函数和字符。语法中使用"|"应用变量操作符,多个参数用":" 分隔开来。
{$name|truncate:10:"..."}
2.常用的变量操作符
capitalize [首字母大写]
count_characters [计算字符数]
cat [连接字符串]
count_paragraphs [计算段落数]
count_sentences [计算句数]
count_words [计算词数]
date_format [时间格式]
default [默认]
escape [转码]
indent[缩进]
lower[小写 ]
nl2br[换行符替换成<br />]
regex_replace[正则替换]
replace[替换]
spacify[插空]
string_format[字符串格式化]
strip[去除(多余空格)]
strip_tags[去除html标签]
truncate[截取]
upper[大写]
wordwrap[行宽约束]
下一篇:PHP中防止SQL注入攻击
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
掌握Google搜索操作符:成为搜索领域的行家里手
搜索像专家一样:Google操作符全解析!!!
搜索 操作符 Google