0
4

2 回答 2

1
于 2012-09-28T19:14:24.907 回答
0

这个怎么样:

$str = '<p><a href="http://www.example.com/">Example.com</a> says that 5 < 6.</p>';
echo $str."\n";
$stripped = strip_tags($str, '<a>');
echo $stripped."\n";

产生输出:

[stou$ ~]$ php hmm.php 
<p><a href="http://www.example.com/">Example.com</a> says that 5 < 6.</p>
<a href="http://www.example.com/">Example.com</a> says that 5 < 6.
[stou$ ~]$

编辑:抱歉错过了关于 html 实体的观点。

于 2012-09-27T18:38:09.753 回答