> Smarty模板引擎中文在线手册 > strip_tags [去除html标签]

strip_tags
去除HTML标签

This strips out markup tags, basically anything between < and >.

去除<和>标签,包括在<和>之间的任何内容.

Example 5-20. strip_tags
例 5-20.去除Html标签

index.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');

index.tpl:

{$articleTitle}
{$articleTitle|strip_tags}

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.
上一篇:
下一篇: