解决PHP中Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the futu

来源:互联网 发布:随机数预测算法 编辑:程序博客网 时间:2024/06/05 07:34

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

说mysql_connect这个模块将在未来弃用,请你使用mysqli或者PDO来替代。

方法一:

在php.ini中更改错误级别 error_reporting = E.ALL & ~E_NOTICE &~ E_DEPRECATED

方法二:

不让其提示错误(不建议)

在php.ini中将 display_errors = On 改为display_errors = Off

方法三:

在php代码中

<?php

error_reporting(E_ALL ^ E_DEPRECATED);


方法四:

将mysql改用mysqli

<?php

$link = mysql_connect('localhost''user''password');

mysql_select_db('dbname'$link);

改成mysqi

$link = mysqli_connect('localhost''user''password''dbname');

mysql_query('CREATE TEMPORARY TABLE `table`'$link);

改为mysqli_query($link'CREATE TEMPORARY TABLE `table`');



0 0
原创粉丝点击