主页 > 编程资料 > PHP >
发布时间:2015-09-23 作者:网络 阅读:126次

1  修饰符:好象没有讲
2  匹配模式好象有些少
比如

<?php 
$cp = preg_replace( "@<script(.*?)</script>@is", "", $cp ); 
            $cp = preg_replace( "@<iframe(.*?)</iframe>@is", "", $cp ); 
            $cp = preg_replace( "@<style(.*?)</style>@is", "", $cp ); 
?>
出现"@<script(.*?)</script>@
我就迷糊

希望得到帮助,多谢  

"@<script(.*?)</script>@

非贪婪模式,意思是匹配<script之后第一个<之间的东西,等价于@<script([^>]*)</script>@

有时候需要[^>]+?获取精确匹配。

关键字词: