复制代码 代码如下:
','>',$string);
$string = str_replace({,'',$string);
$string = str_replace('}','',$string);
$string = str_replace('','',$string);
return $string;
}
?>
$val) $string[$key] = new_addslashes($val);
return $string;
}
?>
-1) ? $safestep : 1;
if($safestep == 1){
$str = preg_replace(#script:#i, script:, $str);
$str = preg_replace(#]*>#isu, '', $str);
$str = preg_replace(#[ ]{1,}#, ' ', $str);
return $str;
}else if($safestep == 2){
$str = addslashes(htmlspecialchars(stripslashes($str)));
$str = preg_replace(#eval#i, 'eval', $str);
$str = preg_replace(#union#i, 'union', $str);
$str = preg_replace(#concat#i, 'concat', $str);
$str = preg_replace(#--#, '--', $str);
$str = preg_replace(#[ ]{1,}#, ' ', $str);
return $str;
}else{
return $str;
}
}
?>
/','',$text);
//完全过滤js
$text = preg_replace('/
0) {
$pattern .= '(';
$pattern .= '([xx]0{0,8}([9ab]);)';
$pattern .= '|';
$pattern .= '|({0,8}([9|10|13]);)';
$pattern .= ')*';
}
$pattern .= $ra[$i][$j];
}
$pattern .= '/i';
$replacement = substr($ra[$i], 0, 2).''.substr($ra[$i], 2); // add in to nerf the tag
$val = preg_replace($pattern, $replacement, $val); // filter out the hex tags
if ($val_before == $val) {
// no replacements were made, so exit the loop
$found = false;
}
}
}
return $val;
}
?>
http://www.bkjia.com/phpjc/825062.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/825062.htmltecharticlephp各种过滤字符函数 复制代码 代码如下: ?php /** * 安全过滤函数 * * @param $string * @return string */ function safe_replace($string) { $string = str_replace('...
