郁闷阿没分$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);

解决方案 »

  1.   

    STRIP_TAGS是去除标记而留下标记的内容
    <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等标记雷同
      

  2.   

    $htm = preg_replace("/<style.+style>/isU", "", $htm);
    $htm = preg_replace("/<script.+script>/isU", "", $htm);
      

  3.   

    过滤<style></style>之间的内容一般在什么情况下能用得到呢?即为什么要过滤<style></style>之间的内容呢?