Home > php教程 > PHP源码 > body text

php POST GET 数据过滤函数

WBOY
Release: 2016-06-08 17:29:10
Original
2224 people have browsed it
<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;
}

Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!