strip_tags
This strips out markup tags, basically anything between < and >.
此函式會省略掉修飾標籤,通常是 < 與 > 之間的所有東西。
Example 5-19. strip_tags
<?php
$smarty = new Smarty; $smarty->assign('articleTitle', "Blind Woman Gets <font face=\"helvetica\">New Kidney</font> from Dad she Hasn't Seen in <b>years</b>."); $smarty->display('index.tpl');
?>
|
where index.tpl is:
其中 index.tpl 的內容為:
{$articleTitle}
{$articleTitle|strip_tags} {* same as {$articleTitle|strip_tags:true} *}
{$articleTitle|strip_tags:false} |
This will output:
輸出結果為:
Blind Woman Gets <font face="helvetica">New Kidney</font> from Dad she Hasn't Seen in <b>years</b>.
Blind Woman Gets New Kidney from Dad she Hasn't Seen in years .
Blind Woman Gets New Kidney from Dad she Hasn't Seen in years. |
|