`
haohappy2
  • 浏览: 315708 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Replace of HTML tag

    博客分类:
  • PHP
 
阅读更多
$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(

 

分享到:
评论

相关推荐

    Java邮件开发Fundamentals of the JavaMail API

    Fundamentals of the JavaMail API Presented by developerWorks, your source for great tutorials ibm.com/developerWorks Table of Contents If you're viewing this document online, you can click ...

    simple-tags

    * The Simple Tags auto completion replace default WordPress Tags input. * Restore administration options. * Better management of Simple Tags with WP_Scripts and WP_Styles * Add an option for auto ...

    Velocity Suite 1.2.3

    [Version 1.0.4 fixed lack of vtl tag hints and vtl code coloring missing in previous versions, to invoke code coloring you must have \"#* velocity document *#\" at the beginning of your .vm or .html ...

    httpd2.2.12.tar

    hunting to replace binary third party modules that were now incompatible. This also left module authors searching through the API change histories to determine the exact cause for the MMN change and ...

    浮点vfdsfJAVA实现链表,双向链表.txtJAVA实现链表,双向链表.txt

    描述&gt;=20个字符,不支持HTML标签。 详细的资源描述有机会获得我们的推荐,更有利于他人下载,赚取更多积分。 &lt;li&gt;&lt;input id="cb_agree" name="cb_agree" type="checkbox" value="" /&gt;同意...

    WordPress 3 Plugin Development Essentials.pdf

    preg_replace 264 print_r 264 sprintf 265 strtolower 265 substr 265 WordPress Functions 266 __ 266 _e 266 add_action 266 add_filter 267 add_meta_box 267 add_options_page 267 check_admin_...

    利用 Oracle 和 PHP 管理分布式跟踪文件

    create or replace library systemcalls is ‘/lib/libc.so‘; / grant necessary database privileges to tfmadmin tfmAdmin_privs_and_syns.sql grant necessary java privileges to tfmadmin tfmAdmin_java_...

    jQuery完全实例.rar

    For example, to create a span use $("&lt;span/&gt;") or $("&lt;span&gt;&lt;/span&gt;") instead of without the closing slash/tag. 返回值 jQuery 参数 html (String) : 用于动态创建DOM元素的HTML标记字符串 示例 动态创建...

    BUS Hound

    The following table describes the units of the time format. &lt;br&gt;Name Units us Microseconds ms Milliseconds sc Seconds mn Minutes hr Hours dy Days &lt;br&gt; Cmd.Phase.Ofs(rep) ...

    php.ini-development

    html_errors ; Default Value: On ; Development Value: On ; Production value: On ; log_errors ; Default Value: Off ; Development Value: On ; Production Value: On ; max_input_time ; Default Value: -1 ...

    LotusDomino学习笔记.doc

    95. Using the DOM to replace "No documents found" 213 96. What you need and want to know about errors 217 97. Processing multiple documents from a view 221 98. Forcing attachments to always download ...

    Visual C++ 编程资源大全(英文源码 其它)

    replaceinfiles.zip Search and Replace in multiple files Add-in for Visual C++ 6.0(83KB)&lt;END&gt;&lt;br&gt;76,RescueAgent.zip A Code Rescue Add-in for Visual C++ Developers(118KB)&lt;END&gt;&lt;br&gt;77,stripem.zip...

    LotusDomino学习笔记(400页涵盖代理和公式使用)

    95. Using the DOM to replace "No documents found" 213 96. What you need and want to know about errors 217 97. Processing multiple documents from a view 221 98. Forcing attachments to always download ...

    Lotus Domino WEB 开发技术积累-DOC(313页)

    95. Using the DOM to replace "No documents found" 213 96. What you need and want to know about errors 217 97. Processing multiple documents from a view 221 98. Forcing attachments to always download ...

    Lotus Domino WEB详细 学习笔记

    95. Using the DOM to replace "No documents found" 213 96. What you need and want to know about errors 217 97. Processing multiple documents from a view 221 98. Forcing attachments to always ...

    JAVA WEB 开发详解:XML+XSLT+SERVLET+JSP 深入剖析与实例应用.part2

    17.7.6 fn:replace 542 17.7.7 fn:substring 543 17.7.8 fn:substringbefore 544 17.7.9 fn:substringafter 544 17.7.10 fn:split 545 17.7.11 fn:join 546 17.7.12 fn:tolowercase 547 17.7.13 fn:...

    JAVA WEB 开发详解:XML+XSLT+SERVLET+JSP 深入剖析与实例应用.part5

    17.7.6 fn:replace 542 17.7.7 fn:substring 543 17.7.8 fn:substringbefore 544 17.7.9 fn:substringafter 544 17.7.10 fn:split 545 17.7.11 fn:join 546 17.7.12 fn:tolowercase 547 17.7.13 fn:...

    JAVA WEB 开发详解:XML+XSLT+SERVLET+JSP 深入剖析与实例应用.part4

    17.7.6 fn:replace 542 17.7.7 fn:substring 543 17.7.8 fn:substringbefore 544 17.7.9 fn:substringafter 544 17.7.10 fn:split 545 17.7.11 fn:join 546 17.7.12 fn:tolowercase 547 17.7.13 fn:...

    JAVA WEB 开发详解:XML+XSLT+SERVLET+JSP 深入剖析与实例应用.part3

    17.7.6 fn:replace 542 17.7.7 fn:substring 543 17.7.8 fn:substringbefore 544 17.7.9 fn:substringafter 544 17.7.10 fn:split 545 17.7.11 fn:join 546 17.7.12 fn:tolowercase 547 17.7.13 fn:...

    ext-2.3.0+CKEditor 3.0.1+ckfinder_asp_1.4配置详解及工程源码

    CKEDITOR.replace(this.id, this.config.CKConfig); }, setValue : function(value){ Ext.form.TextArea.superclass.setValue.apply(this,[value]); CKEDITOR.instances[this.id].setData( value ); }, ...

Global site tag (gtag.js) - Google Analytics