我正在运行此功能来清理我网站上的所有用户输入,但它让我担心它可能会非常耗费性能......
// function for cleaning arrays, recursively for arrays held inside arrays
function array_clean($array)
{
// if its an array, walk each element recursively
if(is_array($array))
{
return array_map("escape", $array);
}
// until its a single element, then clean the single element
else
{
return escape($array);
}
}
// Recursively walk our global variables
$_POST= array_map("array_clean", $_POST);
$_GET= array_map("array_clean", $_GET);
$_REQUEST= array_map("array_clean", $_REQUEST);
$GLOBALS= array_map("array_clean", $GLOBALS);
$_SERVER= array_map("array_clean", $_SERVER);
$_FILES= array_map("array_clean", $_FILES);
$_COOKIE= array_map("array_clean", $_COOKIE);
$_SESSION= array_map("array_clean", $_SESSION);
$_ENV=array_map("array_clean", $_ENV);
我需要你的见解..谢谢