First, we recommend that the filter_sanitize_string and filter_sanitize_string filters remove or encode unnecessary characters.
This filter deletes data that is potentially harmful to the application. It is used to remove tags and delete or encode unnecessary characters.
Name: "string"
Id-number: 513
Possible options or flag:
Filter_flag_no_encode_quotes-this flag is not encoded with quotation marks
Filter_flag_strip_low-Remove characters with ascii values below 32
Filter_flag_strip_high-Remove characters with ascii values greater than 32
Filter_flag_encode_low-characters encoded with ascii values below 32
Filter_flag_encode_high-encode characters with ascii values greater than 32
Filter_flag_encode_amp-encode & character as & amp;
*/
$ Var = "<B> bill gates <B> ";
Var_dump (filter_var ($ var, filter_sanitize_string ));
/*
The second function is strip_tags.
The strip_tags () function removes tags from html, xml, and php tutorials.
Syntax
Strip_tags (string, allow)
*/
Echo strip_tags ("hello <B> world! </B> ");
// Hello world!
Function uh ($ str)
{
$ Farr = array (
"/S + /",
// Filter unnecessary Spaces
"/<(/?) (Script | I? Frame | style | html | body | title | link | meta |? | %) ([^>] *?)> /Isu ",
// Filter <script and other code that may introduce malicious content or maliciously change the display layout. If you do not need to insert flash, you can
To add <object Filtering
"/(<[^>] *) On [a-za-z] + s * = ([^>] *>)/isu ",
// Filter the on events of webpage Special Effects
);
$ Tarr = array (
"",
"<123>", // If You Want To directly clear insecure labels, leave it blank.
"12 ",
);
$ Str = preg_replace ($ farr, $ tarr, $ str );
Return $ str;
}
For more details, see http://www.bKjia. c0m/phper/19/70 dd2a905e74cefc9be9c0f17268dadc.htm
?>