escape[編碼]

##escape[編碼]

##test.php:

#$smarty = new Smarty; $ smarty->assign('articleTitle', "'無棺材葬禮計劃遭到強烈反對'");
$smarty->display('test.html');


# test. html:
{$articleTitle}{$articleTitle|escape}
{$articleTitle|escape:"html"} {* escapes & " ' <> *}
{$articleTitle |escape:"htmlall"} {* 轉義所有html 實體*}
{$articleTitle|escape:"url"}
{$articleTitle|escape:"quotes"}
< a href=" mailto:{$EmailAddress|escape:"hex"}">{$EmailAddress|escape:"hexentity"}</a>



輸出:「預計無棺材葬禮計畫將面臨強烈反對」'預計無棺材葬禮計畫將面臨強烈反對'
&# 039 ;預計對無棺葬禮計劃持強烈反對態度'
'對無棺葬禮計劃持強烈反對態度'
'對無棺葬禮計劃持強烈反對態度'
\'預計對無棺葬禮計劃持強烈反對態度無棺葬禮計劃\'
bob& #x40;me&# x2e;net</a>

#

繼續學習
||
<?php echo "escape[编码]";