escape[encoding]
escape[编码]
test.php:
$smarty = new Smarty;
$smarty->assign('articleTitle', "'Stiff Opposition Expected to Casketless Funeral Plan'");
$smarty->display('test.html');
test.html:
{$articleTitle}
{$articleTitle|escape}
{$articleTitle|escape:"html"} {* escapes & " ' < > *}
{$articleTitle|escape:"htmlall"} {* escapes ALL html entities *}
{$articleTitle|escape:"url"}
{$articleTitle|escape:"quotes"}
{$EmailAddress|escape:"hexentity"}
输出:
'Stiff Opposition Expected to Casketless Funeral Plan'
'Stiff Opposition Expected to Casketless Funeral Plan'
'Stiff Opposition Expected to Casketless Funeral Plan'
'Stiff Opposition Expected to Casketless Funeral Plan'
'Stiff Opposition Expected to Casketless Funeral Plan'
\'Stiff Opposition Expected to Casketless Funeral Plan\'
bob@me.net