正常情况下:
<?php
$a='<p><span style="color:red;">我的外面包裹着html标签<br/>我的上面的换行标签</span></p>';
echo $a;
?>
使用了strip_tags标签后
:
<?php
$a='<p><span style="color:red;">我的外面包裹着html标签<br/>我的上面的换行标签</span></p>';
echo strip_tags($a);
?>
过滤某个html标签
:
该正则表达式为万能公式
<?php
$a='<p><span style="color:red;">我的外面包裹着html标签<br/>我的上面的换行标签</span></p>';
$str=preg_replace("/<(\/?span.*?)>/si","",$a);
echo $str;
?>
查看源码: