Copy CodeThe code is as follows:
$rptype = 0 means only HTML tags are replaced
$rptype = 1 to replace HTML tags while removing contiguous whitespace characters
$rptype = 2 to replace HTML tags while removing all whitespace characters
$rptype = 1 means that only HTML-dangerous tokens are replaced
function Htmlreplace ($str, $rptype =0)
{
$str = Stripslashes ($STR);
if ($rptype ==0)
{
$str = Htmlspecialchars ($STR);
}
else if ($rptype ==1)
{
$str = Htmlspecialchars ($STR);
$str = Str_replace ("", "', $str);
$str = Ereg_replace ("[Rnt]{1,}", ", $str);
}
else if ($rptype ==2)
{
$str = Htmlspecialchars ($STR);
$str = Str_replace ("", "', $str);
$str = Ereg_replace ("[Rnt]", "', $str);
}
Else
{
$str = Ereg_replace ("[Rnt]{1,}", ", $str);
$str = eregi_replace (' script ', ' script ', $str);
$str = Eregi_replace ("<[/]{0,1} (Link|meta|ifr|fra) [^>]*>", ", $str);
}
Return addslashes ($STR);
}
http://www.bkjia.com/PHPjc/322099.html www.bkjia.com true http://www.bkjia.com/PHPjc/322099.html techarticle Copy the code as follows://$rptype = 0 means replacing HTML tags only//$rptype = 1 means replacing HTML tags while removing contiguous whitespace characters//$rptype = 2 means replacing HTML tags at the same time ...