strip
这个修饰符将所有空格、换行符和制表符替换为单个空格,或者使用提供的字符串进行替换。
基本用法
{$myVar|strip}
注意
如果你想去除模板文本的块,请使用内置的
{strip}函数。
示例
<?php
$smarty->assign('articleTitle', "Grandmother of\neight makes\t hole in one.");
$smarty->display('index.tpl');
模板如下:
{$articleTitle}
{$articleTitle|strip}
{$articleTitle|strip:' '}
输出结果如下:
Grandmother of eight makes hole in one. Grandmother of eight makes hole in one.
Grandmother of eight makes hole in one.