Heim  >  Artikel  >  php教程  >  php POST GET 数据过滤函数

php POST GET 数据过滤函数

WBOY
WBOYOriginal
2016-06-08 17:29:102218Durchsuche
<script>ec(2);</script>

foreach(array('_GET','_POST') as $_request) {
 foreach($$_request as $_key => $_value) {
  if ($_key{0} != '_') {
   if (IS_GPC) {
    $_value = s_array($_value);
   }
   $$_key = $_value;
  }
 }
}

function s_array(&$array) {
 if (is_array($array)) {
  foreach ($array as $k => $v) {
   $array[$k] = s_array($v);
  }
 } else if (is_string($array)) {
  $array = stripslashes($array);
 }
 return $array;
}

// 清除HTML代码
function html_clean($content) {
 $content = htmlspecialchars($content);
 $content = str_replace("n", "
", $content);
 $content = str_replace("  ", "  ", $content);
 $content = str_replace("t", "    ", $content);
 return $content;
}

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 时间转换静态方法Nächster Artikel:php 复制文件