Home  >  Article  >  Backend Development  >  PHP能用sprintf函数来防止SQL流入吗

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

WBOY
WBOYOriginal
2016-06-13 12:50:091041browse

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()不会去处理引号。
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn