Mysql with Php 7

雨燕双飞 提交于 2020-01-11 14:55:27

问题


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

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?

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.


回答1:


Well, you better clear that mess up first

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

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?

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

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

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.

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

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



来源:https://stackoverflow.com/questions/41255533/mysql-with-php-7

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!