PHP防注入的最简单函数

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

$_POST = sql_injection($_POST);
$_GET = sql_injection($_GET);

function sql_injection($content)
{
if (!get_magic_quotes_gpc()) {
if (is_array($content)) {
foreach ($content as $key=>$value) {
$content[$key] = addslashes($value);
}
} else {
addslashes($content);
}
}
return $content;
}

转载于:https://my.oschina.net/u/585111/blog/219487

你可能感兴趣的:(PHP防注入的最简单函数)