PDO execute($input_parameter) protects from sql injections as bindParam/bindValue?

前端 未结 2 1269
余生分开走
余生分开走 2021-01-17 20:29

Does execute($input_parameter) protect from sql injections just like bindParam/bindValue?

If the answer is yes, bindParam()/bindValue

2条回答
  •  花落未央
    2021-01-17 20:58

    Yes, it does the same thing. I cannot say that it is invulnerable, because the underlying SQL engine could itself be vulnerable. But that really isn't in your hands anymore.

    So for all practical reasons, yes, its safe.

    EDIT: Look at the PHP Documentation (1st and second example). One is with bindParam() and the other uses execute().

提交回复
热议问题