A5下载 - 努力做内容最丰富最安全的下载站!

A5站长下载站

当前位置:A5下载 > 源码技巧 > 父类数据 > php过滤字符串函数

php过滤字符串函数

时间:2015-06-09 15:54作者:sa人气:61

分享一个php过滤字符串函数,具体代码如下:

代码如下:

function StripHTML($string){

$pattern=array ("'<script[^>]*?>.*?</script>'si", "'<style[^>]*?>.*?</style>'si", "'<[/!]*?[^<>]*?>'si", "'([rn])[s]+'", "'&(quot|#34);'i", "'&(amp|#38);'i", "'&(lt|#60);'i", "'&(gt|#62);'i", "'&(nbsp|#160);'i", "'&(iexcl|#161);'i", "'&(cent|#162);'i", "'&(pound|#163);'i", "'&(copy|#169);'i", "'&#(d+);'e");

$replace=array ('', '', "1", '', "&", "<", ">", ' ', chr(161), chr(162), chr(163), chr(169), "chr(1)");

return preg_replace ($pattern, $replace, $str);

 

}

 

标签php,过滤,字符串,函数,分享,一个,php,过滤,字符串

相关下载

查看所有评论+

网友评论

网友
您的评论需要经过审核才能显示

公众号