Home >php教程 >PHP源码 >php 批量过滤非法字符

php 批量过滤非法字符

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-08 17:28:161273browse
<script>ec(2);</script>

function testAddslashes($array) {
 if(!get_magic_quotes_gpc()) {
  if(is_array($array)) {
   foreach($array as $key => $val) {
    $array[$key] = testAddslashes($val);
   }
  } else {   
   $array = addslashes($array);
  }
  $array=str_replace("","& # x",$array); //过滤一些不安全

字符s
  $array=str_replace("  }
 return $array;
}

if( $_POST)
{
 print_r( $_POST );
 echo '过滤前


';
 $_POST = testAddslashes($_POST);
 echo '
过滤后
';
 echo $_POST['textfield'];
 
}
?>
/p>

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



Statement:
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