我常用的自定义函数之clean php自动过滤功能

常在系统开始加载时引入  
1 if (ini_get('magic_quotes_gpc')) {//php5.4以上版本直接返回false 2 function clean($data) { 3 if (is_array($data)) { 4 foreach ($data as $key => $value) { 5 $data[clean($key)] = clean($value); 6 } 7 } else { 8 $data = stripslashes($data); 9 } 10 11 return $data; 12 } 13 14 $_GET = clean($_GET); 15 $_POST = clean($_POST); 16 $_REQUEST = clean($_REQUEST); 17 $_COOKIE = clean($_COOKIE); 18 }
原文地址:https://www.cnblogs.com/dmm888/p/4377615.html