什么时候应该使用MySQLi代替MySQL? [英] When should I use MySQLi instead of MySQL?
本文介绍了什么时候应该使用MySQLi代替MySQL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人可以为我阐明使用MySQLi代替MySQL的优点和缺点吗?在某些情况下我不应该使用MySQLi?为了使用MySQLi,是否需要对服务器进行不同的配置?例如,我需要升级Apache或PHP以便支持MySQLi吗?
Can someone clarify for me what the advantages and disadvantages of using MySQLi instead of MySQL? Are there situations where I should not use MySQLi? Do I need to configure my server differently in order to use MySQLi? For instance, do I need to upgrade Apache or PHP so I can support MySQLi?
推荐答案
为什么要使用MySQLi扩展而不是MySQL扩展的原因很多:
Reasons why you should use MySQLi extension instead of the MySQL extension are many:
- MySQLi为您提供准备好的语句-一种将数据发送到MySQL并保护您免受SQL注入的安全方法. 仅此一项就足以始终选择MySQLi而不是MySQL .
- MySQLi启用了大多数MySQL功能.
- MySQLi是面向对象的.
- MySQLi支持准备好的语句,事务和多条语句.
- 旧的MySQL扩展名从PHP 5.5.0起已弃用
- MySQLi gives you prepared statements - a safer way of sending data to MySQL and protecting you from SQL injection. This alone should be enough for always choosing MySQLi over MySQL.
- MySQLi enables most of the MySQL features.
- MySQLi is object orientated.
- MySQLi supports prepared statements, transactions and multiple statements.
- The old MySQL extension is deprecated as of PHP 5.5.0
还有其他好处.但是主要的是,您应该专注于安全性和稳定性-MySQLi可以做到这一点.
And there are other benefits. But mainly, you should focus on security and stabiltity - and MySQLi gives you just that.
这篇关于什么时候应该使用MySQLi代替MySQL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文