郁闷阿没分$v=("
替换一些东西
<style> body,table,select,ul,li{font-size:12px;line-height:20px;} asfasfasfas34343433wew4434343sesew </style>
替换一些东西结束
");
$preg_all="/<style>(.*?)<\/style>/";
echo $s=preg_replace($preg_all,"",$v);
替换一些东西
<style> body,table,select,ul,li{font-size:12px;line-height:20px;} asfasfasfas34343433wew4434343sesew </style>
替换一些东西结束
");
$preg_all="/<style>(.*?)<\/style>/";
echo $s=preg_replace($preg_all,"",$v);
<style>和</style>之间的是内容,而不是标记。当然去除不了
规范的html写法中这个内容是放在注释标记里的
<style>
<!--
body,table,select,ul,li{font-size:12px;line-height:20px;}
asfasfasfas34343433wew4434343sesew
-->
</style>
这样就可以被strip_tags去除
如果你书写的不规范,那么就只能用正则表达式来做了
$s = preg_replace($"/<style.+style>/isU", "", $v);stript等标记雷同
$htm = preg_replace("/<script.+script>/isU", "", $htm);