PHP PDO与mysql _ *()的安全优势 [英] Secury Benefits of PHP PDO vs mysql_*()

查看:96
本文介绍了PHP PDO与mysql _ *()的安全优势的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用PHP PDO代替mysql_connect()等是否有安全性?

Are there any security benefits of using PHP PDO instead of the mysql_connect(), etc.?

推荐答案

否.与MySQL扩展相比,PDO没有安全性的好处(除了墨菲法则告诉我们的知识外,这两种方法都适用).两者都将通过转义相同的字符来保证输入的安全性.

No. There is no security benefit to PDO vs the MySQL extension (except for what Murphy's law has taught us, which applies to both). Both will render input safe by escaping the same characters.

但是,PDO还有其他优点:

However, PDO has other advantages:

  • 对准备好的语句的支持;
  • 面向对象的界面;
  • 数据访问抽象;和
  • 产生更干净的代码,因为您可以一次转义多个值

这些通常被认为是最重要的.

These are generally considered as the most important.

这篇关于PHP PDO与mysql _ *()的安全优势的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆