Php filters dangerous html code. The following is the program code: Copy the code as follows: functionuhtml ($ str) {$ farrarray (s +, the following program code is displayed:
The code is as follows:
Function uhtml ($ str)
{
$ Farr = array (
"// \ S +/", // filter unnecessary spaces
// Filter scripts and other code that may introduce malicious content or maliciously change the display layout. if you do not need to insert flash, you can also addFilter
"/<(\/?) (Script | I? Frame | style | html | body | title | link | meta | \? | \ %) ([^>] *?)> /IsU ",
"/(<[^>] *) On [a-zA-Z] + \ s * = ([^>] *>)/isU ", // filter javascript on events
);
$ Tarr = array (
"",
"<\ 1 \ 2 \ 3>", // If you want to directly clear insecure labels, leave it blank.
"\ 1 \ 2 ",
);
$ Str = preg_replace ($ farr, $ tarr, $ str );
Return $ str;
}
The signature code is as follows: function uhtml ($ str) {$ farr = array ("/\ s + /", // filter unnecessary blank spaces // filter scripts and other information that may introduce malicious content or maliciously change the display...