首页 > php代码 > php POST GET 数据过滤函数

php POST GET 数据过滤函数

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", "<br />", $content);
 $content = str_replace("  ", "&nbsp;&nbsp;", $content);
 $content = str_replace("t", "&nbsp;&nbsp;&nbsp;&nbsp;", $content);
 return $content;
}

永久地址:http://www.phprm.com/code/php-POST-GET-function.html

转载随意~请带上教程地址吧^^

标签:none

发表留言