PHP tips: php filters dangerous html code. read PHP tips: php filters dangerous html code. use PHP to filter html code that may be used to introduce external dangerous content. Sometimes, users must submit html content to enrich the information published by users. of course, some codes that may cause messy page layout are also filtered out. <LINKhref = "http: // ww
Use PHP to filter the code that may be used in html to introduce external dangerous content. Sometimes, users must submit html content to enrich the information published by users. of course, some codes that may cause messy page layout are also filtered out.
The following is a reference clip:
# Html published by the user to filter dangerous code
Function uh ($ str)
{
$ Farr = array (
"// \ S +/", // filter unnecessary spaces
"/<(\/?) (Script | I? Frame | style | html | body | title | link | meta | \? | \ %) ([^>] *?)> /IsU ", // filter