宏博网络 | 专注互联网品牌一站式服务

Thank you for visiting

029-81773686

全网开发&整合营销服务商

CopyRight
©HOOBOO All rights reserved

全网开发&整合营销服务商

029-81773686

西安网站建设php正则过滤html标签、空格、换行符的代码(HOOBOO)

2018.08.09

$str=preg_replace("/\s+/", " ", $str); //过滤多余回车 

$str=preg_replace("/<[ ]+/si","<",$str); //过滤<__("<"号后面带空格) 


$str=preg_replace("/<\!--.*?-->/si","",$str); //注释 

$str=preg_replace("/<(\!.*?)>/si","",$str); //过滤DOCTYPE 

$str=preg_replace("/<(\/?html.*?)>/si","",$str); //过滤html标签 

$str=preg_replace("/<(\/?head.*?)>/si","",$str); //过滤head标签 

$str=preg_replace("/<(\/?meta.*?)>/si","",$str); //过滤meta标签 

$str=preg_replace("/<(\/?body.*?)>/si","",$str); //过滤body标签 

$str=preg_replace("/<(\/?link.*?)>/si","",$str); //过滤link标签 

$str=preg_replace("/<(\/?form.*?)>/si","",$str); //过滤form标签 

$str=preg_replace("/cookie/si","COOKIE",$str); //过滤COOKIE标签 


$str=preg_replace("/<(applet.*?)>(.*?)<(\/applet.*?)>/si","",$str); //过滤applet标签 

$str=preg_replace("/<(\/?applet.*?)>/si","",$str); //过滤applet标签 


$str=preg_replace("/<(style.*?)>(.*?)<(\/style.*?)>/si","",$str); //过滤style标签 

$str=preg_replace("/<(\/?style.*?)>/si","",$str); //过滤style标签 


$str=preg_replace("/<(title.*?)>(.*?)<(\/title.*?)>/si","",$str); //过滤title标签 

$str=preg_replace("/<(\/?title.*?)>/si","",$str); //过滤title标签 


$str=preg_replace("/<(object.*?)>(.*?)<(\/object.*?)>/si","",$str); //过滤object标签 

$str=preg_replace("/<(\/?objec.*?)>/si","",$str); //过滤object标签 


$str=preg_replace("/<(noframes.*?)>(.*?)<(\/noframes.*?)>/si","",$str); //过滤noframes标签 

$str=preg_replace("/<(\/?noframes.*?)>/si","",$str); //过滤noframes标签 


$str=preg_replace("/<(i?frame.*?)>(.*?)<(\/i?frame.*?)>/si","",$str); //过滤frame标签 

$str=preg_replace("/<(\/?i?frame.*?)>/si","",$str); //过滤frame标签 


$str=preg_replace("/<(script.*?)>(.*?)<(\/script.*?)>/si","",$str); //过滤script标签 

$str=preg_replace("/<(\/?script.*?)>/si","",$str); //过滤script标签 

$str=preg_replace("/javascript/si","Javascript",$str); //过滤script标签 

$str=preg_replace("/vbscript/si","Vbscript",$str); //过滤script标签 

$str=preg_replace("/on([a-z]+)\s*=/si","On\\1=",$str); //过滤script标签 

$str=preg_replace("/&#/si","&#",$str); //过滤script标签,如javAsCript:alert( 



让价值共享 记录企业发展脚步 感恩相伴


温馨提醒:找西安做网站的公司,请选择手续齐全、业务精、服务好的正规公司


上一篇:西安网站建设https 页面中引入 http 资源的解决方式(HOOBOO)

下一篇:西安做网站PHP生成随机字符串(HOOBOO)

关键字: 平台建设、PC版网站、官网建设、网页制作、网页设计、网站建设、网站公司、网络公司、知识分享、行业资讯、网络行业、宏博原创

CopyRight © 西安宏博网络科技有限公司   备案号:陕ICP备10007014号-8   站点地图 免责声明:本网站部分资源来源于网络,如有侵权,请联系我们告知删除,我们将会尽快处理,谢谢!本站不承担任何法律责任。