MySQL与PHP 7 [英] Mysql with Php 7

查看:43
本文介绍了MySQL与PHP 7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们计划将代码库从PHP5升级到PHP7.

We are planning to upgrade our code base from PHP5 to PHP 7.

我知道php 7中已弃用mysql_*函数.那么我们是否必须用mysqli_*或pdo重写所有代码?还有其他选择吗?

I understand that mysql_* functions are deprecated in php 7. So do we have to rewrite all our code in mysqli_* or pdo? Is there any alternative for this?

如果没有,您会建议在mysqli_*和pdo之间选择哪一个?

If not, which one would you suggest between mysqli_* and pdo?

我们有一个庞大的代码库,因此更改所有代码将是一项艰巨的任务,因此我们正在寻找替代方案.

We have a huge code base, so changing all the code will be a colossal task, so we're looking for an alternative.

推荐答案

好吧,您最好先清除它们

Well, you better clear that mess up first

我们计划将代码库从PHP5升级到PHP7.

We are planning to upgrade our code base from PHP5 to PHP 7.

您是否在谈论代码库"?那是什么意思也许您想更改服务器上运行的PHP版本?

Are you talking of the "codebase"? What so you mean? May be you want to change the version of PHP you are running on your servers?

我了解php 7中不推荐使用mysql_ *函数.

I understand that mysql_* functions are deprecated in php 7.

您理解错了.在5.5中已弃用,在7中已删除.

You understand it wrong. It was deprecated somewhere in 5.5 and removed in 7.

那么我们是否必须用mysqli_ *或pdo重写所有代码?

So do we have to rewrite all our code in mysqli_* or pdo?

您不是说要更改代码库吗?如果是这样,重写代码库以进行更改有什么问题?

Didn't you say that you wanted to change the codebase? If so, what's the problem with rewriting the codebase in order to change it?

还有其他选择吗?

Is there any alternative for this?

是的, .但是所有这些都没有意义.

Well yes, there are. But there is little point in all of them.

如果没有,您建议在mysqli_ *和pdo之间选择哪一个?

If not, which one would you suggest between mysqli_* and pdo?

我们建议使用PDO ,如果您仍然打算在代码中直接使用API​​函数而不使用任何中间包装器.

We would recommend PDO, if you still going to use API functions right in the code without any intermediate wrapper.

这篇关于MySQL与PHP 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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