当前位置: 代码迷 >> PHP >> PHP能用sprintf函数来防止SQL流入吗
  详细解决方案

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

热度:125   发布时间:2013-04-02 12:35:26.0
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()不会去处理引号。
  相关解决方案