最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Smarty中的注释和截断功能介绍
时间:2026-09-20 19:50:02 编辑:袖梨 来源:一聚教程网
注释复制代码 代码如下:{* 这是一个单行Smarty注释 来自于jb51.net,网页源代码里看不见*}
{* 这是一个多行 Smarty注释 并不发送到浏览器*}
模板注释由星号包围,继而由分隔符包围,型如:{* 这是一个注释 *}。Smarty注释不会在最终模板的输出中显示,这点和不同。前者对于在模板中插入内部注释有用,因为没有人能看到。;-)
http://www.i*tlearne**r.com/code/smarty_cn/language.basic.syntax.html
截断truncate复制代码 代码如下:$smarty->assign('hxtitle', 'Two Sisters Reunite after Eighteen Years at Checkout Counter.');
模板为:复制代码 代码如下:{$hxtitle}{$hxtitle|truncate}{$hxtitle|truncate:30}{$hxtitle|truncate:30:""}{$hxtitle|truncate:30:"---"}{$hxtitle|truncate:30:"":true}{$hxtitle|truncate:30:"...":true}{$hxtitle|truncate:30:'..':true:true}输出为:复制代码 代码如下:Two Sisters Reunite after Eighteen Years at Checkout Counter.Two Sisters Reunite after Eighteen Years at Checkout Counter.Two Sisters Reunite after...Two Sisters Reunite afterTwo Sisters Reunite after---Two Sisters Reunite after EighTwo Sisters Reunite after E...Two Sisters Re..ckout Counter.可以不用在PHP里截取了:http://www.*itlea*rn*er.com/code/smarty_cn/language.modifier.truncate.html
相关文章
- 用 Electron 与 FastAPI 构建流式 Agent 对话 09-20
- JS中彻底删除JSON对象组成的数组中的元素 09-20
- JEV人工智能官网入口:Jev AI国内访问与申请教程 09-20
- 用蓝耘元生代搭建本地图库语义搜索:一句话定位目标图片 09-20
- 企业级 Agent 如何从提效走向增收:落地路径与实践解析 09-20
- Smarty的配置与高级缓存技术分享 09-20