Smarty strip_tags 去除html标签示例!

jackxiang 2009-2-4 18:40 | |
strip_tags
去除html标签
This strips out markup tags, basically anything between < and >.

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

Example 5-20. strip_tags
Smarty手册范例 5-20.去除Html标签

index.php:

$smarty = new Smarty;
$smarty->assign('articleTitle', "Blind Woman Gets New Kidney from Dad she Hasn't Seen in years.");
$smarty->display('index.tpl');

index.tpl:

{$articleTitle}
{$articleTitle|strip_tags}

输出结果:

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.


作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:http://jackxiang.com/post/1604/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!

评论列表
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]