0

您好,尝试连接到数据库,但我无法执行此操作,我使用 laragon 运行程序并显示此错误。数据库连接是 adodb 和 mysql。感谢帮助。

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; ADODB_Cache_File has a deprecated constructor in C:\laragon\www\FacturaElectronicaAlumgo\sistema\adodb5\adodb.inc.php on line 233

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; ADOConnection has a deprecated constructor in C:\laragon\www\FacturaElectronicaAlumgo\sistema\adodb5\adodb.inc.php on line 327

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; ADORecordSet has a deprecated constructor in C:\laragon\www\FacturaElectronicaAlumgo\sistema\adodb5\adodb.inc.php on line 2854

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; ADORecordSet_array has a deprecated constructor in C:\laragon\www\FacturaElectronicaAlumgo\sistema\adodb5\adodb.inc.php on line 3872

Fatal error: Uncaught Error: Call to undefined function mysql_pconnect() in C:\laragon\www\FacturaElectronicaAlumgo\sistema\adodb5\drivers\adodb-mysql.inc.php:383 Stack trace: #0 C:\laragon\www\FacturaElectronicaAlumgo\sistema\adodb5\adodb.inc.php(588): ADODB_mysql->_pconnect('localhost', 'root', 'black44265769', 'cal24412_dte') #1 C:\laragon\www\FacturaElectronicaAlumgo\sistema\conexion.php(3): ADOConnection->PConnect('localhost', 'root', 'black44265769', 'cal24412_dte') #2 C:\laragon\www\FacturaElectronicaAlumgo\sistema\validar.php(8): include('C:\\laragon\\www\\...') #3 {main} thrown in C:\laragon\www\FacturaElectronicaAlumgo\sistema\adodb5\drivers\adodb-mysql.inc.php on line 383

4

1 回答 1

1

什么PHP版本?由于“已弃用”消息和最后一个“致命”错误,我在这里(可能)假设为 7.x。

这是一个两部分的问题...

  1. 已弃用的:

    PHP 已更改为使用__construct() (两个前导下划线)作为构造函数,而不是使用与类本身相同的名称。有关更多信息,请参阅PHP 4 样式构造函数部分(页面上的第一部分)。

    例如:在ADOConnection has a deprecated constructor...构造函数的文件中可能如下所示:

    ADOConnection( ... ); // constructors with or without parameters
    

    ...但所有这些都可以替换为:

    __construct( ... );
    

    您可以在本地进行更改以解决已弃用的消息。

  2. 致命错误:

    在 PHP 7.x 中,删除了基于 mysql_* 的函数。请参阅此 API 信息

于 2017-07-18T17:37:00.920 回答