解析smarty 截取字符串函数 truncate的用法介绍
smarty truncate 截取字符串
从字符串开始处截取某长度的字符,默认的长度为80
指定第二个参数作为截取字符串的长度
默认情况下,smarty会截取到一个词的末尾,
如果需要精确到截取多少个字符可以使用第三个参数,将其设为”true”
具体用法如下:
//index.php $smarty = new Smarty;
$smarty->assign('supportTitle', 'Two Sisters Reunite after Eighteen Years at Checkout Counter.');
$smarty->display('index.tpl');
//index.tpl
{$supportTitle}
{$supportTitle|truncate}
{$supportTitle|truncate:30}
{$supportTitle|truncate:30:""}
{$supportTitle|truncate:30:"---"}
{$supportTitle|truncate:30:"":true}
{$supportTitle|truncate:30:"...":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 after
Two Sisters Reunite after—
Two Sisters Reunite after Eigh
Two Sisters Reunite after E…
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:service@webmeng.net 进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。
以上信息是否解决您的问题?
相关问题
- 步骤四:挂载磁盘
- 步骤三:连接云服务器
- 步骤二:购买云服务器
- 步骤一:进入购买入口
- Linux如何通过Xshell 远程连接服务器
- Linux 如何开放端口和关闭端口
- 宝塔Linux命令大全
- 怎么下载学校免费版Xshell连接Linux系统
- Windows 2008 2012修改远程端口
- 怎么用Windows2008或Windows2012利用IIS搭建网站
- 远程桌面身份验证错误:要求的函数不正确等解决办法
- Windows2008或Windows2012如何扩容硬盘
- 如何在谷歌官网下载谷歌浏览器
- Windows系统如何通过系统自带软件远程连接服务器
- 解决宝塔远程mysql问题
- Navicat连接错误1130:is not allowed to...
- 解决1130 is not allowed to connect ...
- 宝塔面板安装nginx,宝塔nginx配置文件
- MySQL PHPmyadmin 数据库导出报错Fatal err...
- Winwebmail能发邮件不能收邮件的解决方法
- 中国境内ICP备案材料清单
- winwebmail邮件系统 v3.9.0.7中文破解版
- C盘空间不足怎么办?5种方法获得更多空间!
- 安全实用的应用迁移方法推荐!
- linux开启端口命令
- linux开启端口
- Linux怎么查看操作系统版本号
- linux centos中升级更新命令yum upgrade和yu...
- Linux下平滑升级nginx
- 50个最常用的Unix/Linux命令
- [分享]云服务器挂马清理实例
- 新手入门——部署一个网站需要准备什么
- 虚拟主机相关基础知识
- 从域名到网站,只需四步!
- 全国各省备案基本要求一览表
- 互联网网站如何备案?
- 域名的实名审核需要多久?
- 怎么在服务器绑定域名
- 快速添加域名解析
- 无法登录云服务器?
餐厅介绍
自助餐厅
用户评论