跳转到主内容
趣航编程网 - 趣学编程,启航技术之路!

php利用正则过滤各种标签,空格,换行符的代码_PHP教程

收集 php 利用正则过滤各种标签,空格,换行符的代码: PHP 8.5.5 PHP 8.5.5 是 PHP 8.5 分支的维护更新版本。该版本延续了“小步快跑”的迭代逻辑,通过深度错误修复、底层性能微调以及安全加固,旨在为开发者提供一个更健壮、更高效的运行环境。该版本严格遵守语义化版本规范,不包含破坏性变更。 下载
$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标签
您可能感兴趣的文章 PHP压缩html网页代码(清除空格,换行符,制表符,注释标记) php 将字符串中的连续多个空格转换为一个空格 css控制英文、中文强制换行与不换行的代码 通用的PHP防注入漏洞攻击的过滤函数代码 php利用array_flip实现数组键值交换去除数组重复值 Javascript将内容分享到各大社交平台网站的代码总结 php如何清除html格式并去除文字中的空格然后截取文字 禁止网页右键、复制、另存为、查看源文件等功能实现网页源代码保护 http://www.bkjia.com/PHPjc/764093.html www.bkjia.com true http://www.bkjia.com/PHPjc/764093.html TechArticle 收集php利用正则过滤各种标签,空格,换行符的代码: $str=preg_replace("/s+/", " ", $str); //过滤多余回车$str=preg_replace("/[ ]+/si","",$str); //过滤_...

相关文章