例子5-15. regex_replace
<?php
$smarty->assign('articleTitle', "Infertility unlikely to\nbe passed on, experts say.");
?>
|
模板为:
{* 将每个回车,制表符和新行替换为空格 *}
{$articleTitle}
{$articleTitle|regex_replace:"/[\r\t\n]/":" "} |
输出为:
Infertility unlikely to
be passed on, experts say.
Infertility unlikely to be passed on, experts say. |
|