当前位置:Gxlcms > PHP教程 > PHP能用sprintf函数来防止SQL流入吗

PHP能用sprintf函数来防止SQL流入吗

时间:2021-07-01 10:21:17 帮助过:22人阅读

PHP能用sprintf函数来防止SQL注入吗?
$sql = sprintf("select count(*) as qty from t_user where f_uid='%s' and f_password='%s'",$password,$userAccount);

这句话能挡住SQL注入吗? sql注入


------解决方案--------------------
不能,SQL注入的关键在于引号,而sprintf()不会去处理引号。

人气教程排行