当前位置:首页 > PHP教程 >

mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead

发布时间:2023-07-22 09:29:22 作者:佚名 阅读:(174)

由于服务器重装之后,在部署环境的时候PHP的版本比之前高了一些,在执行程序的时候却提示:mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead,接下来云梦编程为大家介绍一下解决方法,有需要的小伙伴可以参考一下:

mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead

1、错误提示:

[ error ] [8192]mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead

2、解决方法:

    (1)、方法一:关闭错误日志

display_errors = On
改为
display_errors = Off

    (2)、方法二:更改数据库链接语法:

$DB = mysql_connect('localhost', 'username', 'password');
//将mysql_connect直接替换为mysqli_connect,
$DB = mysqli_connect('localhost', 'username', 'password');

    (3)、方法三:更改错误日志报警级别

error_reporting(E_ALL ^ E_DEPRECATED);


以上就是云梦编程为大家介绍的关于mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead的解决方法,了解更多相关文章请关注云梦编程网!

© 2023 - 云梦编程网 版权所有 鲁ICP备2021017318号-4