English 中文(简体)
哪个速度更快,更轻, Mysqli & PDO
原标题:Which one is faster and lighter - mysqli & PDO

我使用“强”MySQL mysql{{/code>功能不再得到维护,社区已经开始http://news.php.net/php.interests/53799> rel=“nofollow noreferrerr”> deprecation procation process 。所以我决定离开mysql{/code>。 问题是:我在哪里寻找更轻、更简单、更快的方式。有人告诉我其中哪一个(mysqli )。

  1. faster
  2. easy to learn and code
  3. consumes less space and memory

注:这两个课程的初学者级教学链接将很有帮助。

最佳回答

http://net.tutsplus.com/tutorics/php/pdo-vs-mysqli-what-should-you-use/"rel=“noreferr”/PDO vs. MySQLi:你应该使用什么?

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!

"https://i.sstatic.net/flfZa.png" alt="摘要"/ >

"https://i.sstatic.net/480Zj.png" alt="数据支持"/>

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.

‘ enger_ @%em> 所以, 如果您仍然和 MySQLi 合作, 也许该是改变的时候了!

http://net.tutsplus.com/tutorics/php/pdo-vs-mysqli-what-should-you-use/"rel="noreferrer"/PDO vs. MySQLi:你应该使用什么?

希望这能帮上忙。

问题回答

除上述问题外,这里还有一份比较图表;

""https://i.stack.imgur.com/ZafgG.png" alt="在这里输入图像描述"/ >

http://net.tutsplus.com/tutominals/php/ why-you-should-be-using-phps-pdo-for-database-access/"rel="不跟随 nofollow noreferrer"<为什么你应该使用PHP的 PDO 数据库存取 来帮助我们。

" 强力 " 关于业绩

虽然 PDO 和 MySQLi 都相当快, MySQLi 的表现在基准值上却非常快 — — 未准备的语句为~2.5%,已准备的语句为~6.5%。 MySQL 扩展速度甚至更快。





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...