function str_check($str){ if(!get_magic_quotes_gpc()){ // 判断magic_quotes_gpc是否打开 $str = addslashes($str); // 进行过滤 } return $str; }
function str_check($str){ if(!get_magic_quotes_gpc()){ // 判断magic_quotes_gpc是否打开 $str = addslashes($str); // 进行过滤 } $str = str_replace("_", "\_", $str); // 把 '_'过滤掉 $str = str_replace("%", "\%", $str); // 把' % '过滤掉 return $str; }