记得以前写过一篇文章
php有效的过滤html标签,js代码,css样式标签:
复制代码 代码如下:
$str = preg_replace( "@<script>@is", "", $str ); <BR>$str = preg_replace( "@<iframe(.*?)@is", "", $str ); <BR>$str = preg_replace( "@<style(.*?)@is", "", $str ); <BR>$str = preg_replace( "@<(.*?)>@is", "", $str ); <BR>?> <BR></script>
,全是正则过滤HTML标签,但是今天自己拿来用都不好用了.原因??就是标签转义了.比如
.页面上显示的是这个.但是源文件却显示的像这样:”——但是我们还是可以处理,先把内容全部反编译过来.再过滤就行了.
复制代码 代码如下:
$str= htmlspecialchars_decode($str);
用htmlspecialchars_decode这个函数的就是把源文件转成这样的标签.然后”:
复制代码 代码如下:
$str= preg_replace("//","",$str);

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SublimeText3 Chinese version
Chinese version, very easy to use

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
