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

php 批量过滤非法字符

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-08 17:28:161274Durchsuche
<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">



Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel:php foreach 遍历数组的例子Nächster Artikel:do while 循环实例详解