下面分别介绍这两个函数。
1.htmlentities()函数:
说明:将html标签转换成特殊字符。例如将<sc
例子:
上面的语句执行后,将生成下面的结果:
I am going to hax0r your site, hahaha!
<script type='text/javascript'>
window.location = 'http://www.88web.org/'
</script>' 2.html_entity_decode()函数说明:将htmlentities()函数转义过的字符串转成html标签。
例子:
$orig = "I'll /"walk/" the <b>dog</b> now";
$a = htmlentities($orig);
$b = html_entity_decode($a);
echo $a; // I will "walk" the <b>dog</b> now
echo $b; // I will "walk" the <b>dog</b> now 