我有这个问题需要澄清.我阅读了一些文档和评论,但仍有一些不够清楚.
I have this very question to clear things up. I read some documentation and comments around but still somethings are just not clear enough.
但这是我的问题,对于准备好的语句,我们是否必须对我们在语句中使用的数据使用参数绑定?好的做法还是必须的?我知道如果您多次运行相同的查询,准备好的语句在性能方面是很好的,但这足以保护查询本身吗?或绑定参数是必须的?绑定参数究竟是什么以及它如何保护数据免受 sql 注入?如果您指出我们对我上述陈述的任何误解,我们也将不胜感激.
But here is my question, with prepared statement, do we have to use parameter binding with the data we use in our statement? good practice or have to? I understand prepared statements are good perfermance-wise if you run the same query multiple times but it is enough to secure the query itself? or binding parameters is a must? What exactly do the binding parameters and how it works to protect the data from sql injection? Also would be appreciated if you point our any misunderstanding about the statements I made above.
简而言之,
这篇关于PDO 与 MYSQLI,准备好的语句和绑定参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
PHP、MySQL PDOException 的死锁异常代码?Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死锁异常代码?)
PHP PDO MySQL 可滚动游标不起作用PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滚动游标不起作用)
PHP PDO ODBC 连接PHP PDO ODBC connection(PHP PDO ODBC 连接)
使用 PDO::FETCH_CLASS 和魔术方法Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔术方法)
php pdo 只从 mysql 获取一个值;等于变量的值php pdo get only one value from mysql; value that equals to variable(php pdo 只从 mysql 获取一个值;等于变量的值)
MSSQL PDO 找不到驱动程序MSSQL PDO could not find driver(MSSQL PDO 找不到驱动程序)