Home > Backend Development > PHP Tutorial > PHP filter unsafe character function_PHP tutorial

PHP filter unsafe character function_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 17:09:19
Original
829 people have browsed it

php filter unsafe character function

function uh($str)
{
$farr = array(
"/s+/",//Filter excess whitespace
"/<(/?)(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 don’t need to insert flash, etc., you can also add "/(<[^>]*)on[a-zA-Z]+s*=([^>]*>)/isU",//Filter JavaScript on event
);
$tarr = array(
" ",
"<\1\2\3>", //If you want to directly clear unsafe tags, you can leave it blank here
"\1\2",
);

$str = preg_replace($farr,$tarr,$str);
Return $str;

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/629755.htmlTechArticlephp filter unsafe character function function uh($str) { $farr = array( /s+/,// Filter excess whitespace/(/?)(script|i?frame|style|html|body|title|link|meta|?|%)([^]*?)/isU,//Filter scr...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template