时间:2021-07-01 10:21:17 帮助过:14人阅读
Test paragraph.
Other text';// Allow
and
echo strip_tags($text, '
');
?>
结果为(去掉了注释):
Test paragraph. Other text2.相反,只去掉某一个html标签Test paragraph.
Other text
$str = 'red text';
$tags = 'font';
$a = strip_only($str, $tags); // red text
$b = strip_only($str, $tags, true); // text
?>
http://www.bkjia.com/PHPjc/621724.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/621724.htmlTechArticle1.把html元素全部去掉,或者保留某几个html标签 代码如下:?php $text = 'pTest paragraph./p!-- Comment -- a href="#fragment"Other text/a'; echo strip_...