【发布时间】:2022-01-17 20:00:17
【问题描述】:
我安装了 PHP 8.1,但出现关于已弃用函数的错误。您对此有什么想法并解决它吗?
不推荐使用:OM\Db::prepare(string $statement, $driver_options = null) 的返回类型应该与 PDO::prepare(string $query, array $options = []): PDOStatement|false 兼容,或者应该使用 #[\ReturnTypeWillChange] 属性来暂时抑制第 114 行 //OM/Db.php 中的通知
第 114 行
protected ?array $driver_options = null;
protected ?array $options = null;
public function prepare(string $statement, ?array $driver_options = null) //php8
{
$statement = $this->autoPrefixTables($statement);
$DbStatement = parent::prepare($statement, \is_array($driver_options) ? $driver_options : []);
$DbStatement->setQueryCall('prepare');
$DbStatement->setPDO($this);
return $DbStatement;
}
【问题讨论】: