PHP的strip_tags()函数,剔除标签,返回字符串
例子:
<?php
$text = '<p>the link.</p><!-- Comment --> <a href="#">click here</a>';
echo strip_tags($text);
echo "\n";
// 允许 <p> 和 <a>
echo strip_tags($text, '<p><a>');
?>
输出:
the link.click here.
<p>the link.<p><a href="#">click here</a>
把代码包含在下面的标签里,网页显示效果可能好些:
<code></code>
<PRE></PRE>