Home  >  Article  >  Backend Development  >  php 参数化查询

php 参数化查询

WBOY
WBOYOriginal
2016-06-20 12:54:061800browse

在学习注入时,MetInfo cms中出现一个注入点,我寻到源代码:

$show = $db->get_one("SELECT * FROM $met_column WHERE id=$id and module=1");

不懂php,看到这个,就误以为这是参数化。参数化不是可以防注入么,怎么还会有注入点呢。

后面深入了解发现。所谓的参数话查询,不是指程序层面的参数话,而是指数据库接口的参数化。 形式:

fetch_one('select * from user where name=?', @name)

对于php采用了参数查询后,是能做到防注入的。

可以了解的php参数化查询资料

  • 使用参数化查询防止SQL注入
  • PHP 中使用参数化查询
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