strip
将所有重复的空格、换行、制表符等替换为单个的空格或指定的字符串。
例子5-19. 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. |
|
参见{strip}和truncate。