php 如何将我的网站从 mysql 迁移到 mysqli?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4598854/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I migrate my site from mysql to mysqli?
提问by dac
Is there anything I have to do on the database end or is it just the php that changes? Can I just substitute mysqli functions for mysql functions? Anything else I should know?
有什么我必须在数据库端做的事情还是只是改变了 php?我可以用 mysqli 函数代替 mysql 函数吗?还有什么我应该知道的吗?
回答by BasBenIk
I advise you to read through this. A lot of helpful information for what you want to do, plus a tool to help. See: Converting to MySQLi.
我建议你通读一遍。很多关于您想要做什么的有用信息,以及一个帮助工具。请参阅:转换为 MySQLi。
It's just the PHP that changes.
只是 PHP 发生了变化。
回答by PseudoNinja
Everything I know about it says that the only changes you will have to make will be in the PHP. With that said be careful not all functions have the same name between the two so be careful changing from mysql_* to mysqli_*.
我所知道的一切都表明,您必须进行的唯一更改将在 PHP 中进行。话虽如此,请注意并非所有函数在两者之间都具有相同的名称,因此请小心从 mysql_* 更改为 mysqli_*。
The site php.net will be your best friend.
网站 php.net 将是您最好的朋友。
回答by markogrady
Also if you are migrating you should look into using PHP Data Objects (PDO) http://php.net/manual/en/book.pdo.php
此外,如果您正在迁移,您应该考虑使用 PHP 数据对象 (PDO) http://php.net/manual/en/book.pdo.php