gpt4 book ai didi

php - 哪个更快更轻-mysqli & PDO

转载 作者:IT王子 更新时间:2023-10-28 23:53:31 26 4
gpt4 key购买 nike

我正在使用 MySQLPHP5。我知道不再维护古老的 mysql_* 函数,社区已经开始 deprecation process .所以我决定放弃 mysql_*。问题是去哪里?我正在寻找更轻、更简单、更快的方法。有人告诉我其中哪些 (mysqliPDO) 是;

  1. 更快
  2. 易于学习和编码
  3. 占用更少的空间和内存

注意:这两个初学者级别的教程链接会很有帮助。

最佳答案

PDO vs. MySQLi: Which Should You Use?

Both PDO and MySQLi offer an object-oriented API, but MySQLi also offers a procedural API – which makes it easier for newcomers to understand. If you are familiar with the native PHP MySQL driver, you will find migration to the procedural MySQLi interface much easier. On the other hand, once you master PDO, you can use it with any database you desire!

Summary

DataBase Support

Ultimately, PDO wins this battle with ease. With support for twelve different database drivers (eighteen different databases!) and named parameters, we can ignore the small performance loss, and get used to its API. From a security standpoint, both of them are safe as long as the developer uses them the way they are supposed to be used.

因此,如果您仍在使用 MySQLi,也许是时候做出改变了!

PDO vs. MySQLi: Which Should You Use? - By Dejan Marjanovic

希望这会有所帮助。

关于php - 哪个更快更轻-mysqli & PDO,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10696696/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com