首页 > 开发 > PHP > 正文

php防注

2024-05-04 22:13:57
字体:
来源:转载
供稿:网友
$_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;
}
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表