strip
转换连续空格,回车和tab到单个空格或是指定字符串。
说明
如果你希望转换模板文字内的空格,使用内置的 {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.
原文: https://www.smarty.net/docs/zh_CN/language.modifier.strip.tpl