什么时候应该使用MySQLi代替MySQL? [英] When should I use MySQLi instead of MySQL?

查看:77
本文介绍了什么时候应该使用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:

  1. MySQLi为您提供准备好的语句-一种将数据发送到MySQL并保护您免受SQL注入的安全方法. 仅此一项就足以始终选择MySQLi而不是MySQL .
  2. MySQLi启用了大多数MySQL功能.
  3. MySQLi是面向对象的.
  4. MySQLi支持准备好的语句,事务和多条语句.
  5. 旧的MySQL扩展名从PHP 5.5.0起已弃用
  1. 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.
  2. MySQLi enables most of the MySQL features.
  3. MySQLi is object orientated.
  4. MySQLi supports prepared statements, transactions and multiple statements.
  5. 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屋!

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