pdo相对于mysql_ *或mysqli_ *的优势 [英] Advantages of pdo over mysql_* or mysqli_*

查看:48
本文介绍了pdo相对于mysql_ *或mysqli_ *的优势的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到有很多人正在使用或迁移到pdo,我以前从未使用过,我真的很不愿意改变,我仍然没有改变,但是我想从谁那里每天都使用pdo为什么我要更改为pdo,我的意思是它比mysql_ *或mysqli_ *有什么优势,我对此进行了很多搜索,但还没有找到满意的答案.谢谢

I have noticed that a lot of people are using or migrating to pdo, I have never used that before and I was really reluctant to change to that, I still have not changed anyway, but I would like to know from people who use the pdo everyday why I should change to that, I mean what advantages does it have over mysql_* or mysqli_*, I have googled a lot about that but I have not found a satisfactory answer yet. Thanks

推荐答案

这与通过一个应用程序支持多个数据库无关(尽管可以,但要小心).这并不是要在将来轻松更改数据库(尽管有帮助).这是关于要使用一个一致,明智的界面,而不管数据库如何.这不仅使程序员(使他们的技能更广泛地适用)和项目(使程序员更容易投入)受益,而且使创建一层库的 lot 变得更容易.在数据访问层之上. Perl拥有DBI已有20年了,这绝对是一件好事. PDO是一个非常相似的概念(实际上,它至少窃取了DBI界面的一半).

It's not about supporting multiple databases with one app (although you can, with care). It's not about making it easy to change databases in the future (although it helps). It's about having one consistent, sensible interface to use regardless of database. Not only does that benefit programmers (by making their skills more broadly applicable) and projects (by making it easier for programmers to jump in), it also makes it a lot easier to create libraries that sit one layer above the data access layer. Perl has had the DBI for 20 years and it's been a decidedly good thing. PDO is a very similar concept (in fact it steals at least half of DBI's interface).

这篇关于pdo相对于mysql_ *或mysqli_ *的优势的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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