本文介绍了为什么要在PHP中通过MySQL使用PDO?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近问了一个问题,结果有人告诉我在MySQL上使用"PDO".这是为什么?它相对于其他有什么优势?

I recently asked a question that resulted in people telling me to use "PDO" over MySQL. Why is that? What advantages does it have over the other?

推荐答案

mysql_*函数已不再维护,社区已开始弃用过程.相反,您应该了解准备的声明,并使用 PDO MySQLi .

The mysql_* functions are no longer maintained and community has begun the deprecation process. Instead you should learn about prepared statements and use either PDO or MySQLi.

如果您不确定,本文应该可以帮助您选择.但是,您应该知道,PDO可以与各种RDBMS一起使用,而MySQLi是为特定的RDBMS制作的.

If you cannot decide, this article should help you choose. Though, you should know, that PDO is able to work with different kinds of RDBMS, while MySQLi is made for a specific one.

如果您决定使用PDO,建议您遵循本教程.

In case you decide to go with PDO, it's recommended you follow this tutorial.

这篇关于为什么要在PHP中通过MySQL使用PDO?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 09:35
查看更多