php:
HTMLSpecialChar
smarty 用 escape
{$articleTitle|escape}
{$articleTitle|escape:"html"} {* escapes & " ' < > *}
{$articleTitle|escape:"htmlall"} {* escapes ALL html entities *}
{$articleTitle|escape:"url"}
{$articleTitle|escape:"quotes"}
<a href="mailto:{$EmailAddress|escape:"hex"}">{$EmailAddress|escape:"hexentity"}</a>
上面是处理代码转义的
下面这个是处理 换行的
PHP nl2br()
smarty
{{$content|nl2br}}
整个合起来是
{{$content|escape:"html"|nl2br}}
smarty 用 escape
{$articleTitle|escape}
{$articleTitle|escape:"html"} {* escapes & " ' < > *}
{$articleTitle|escape:"htmlall"} {* escapes ALL html entities *}
{$articleTitle|escape:"url"}
{$articleTitle|escape:"quotes"}
<a href="mailto:{$EmailAddress|escape:"hex"}">{$EmailAddress|escape:"hexentity"}</a>
上面是处理代码转义的
下面这个是处理 换行的
PHP nl2br()
smarty
{{$content|nl2br}}
整个合起来是
{{$content|escape:"html"|nl2br}}