严格标准:资源 ID#7 用作偏移量,转换为整数 (7)


Strict Standards: Resource ID#7 used as offset, casting to integer (7)

>我在我的网站上使用 Adodb,在设置完所有内容后,我得到:

严格标准:资源 ID#7 用作偏移量,在第 485 行的/home/linuxshi/public_html/shipper_new/adodb/drivers/adodb-mysql.inc.php 中转换为整数 (7)

我无法理解这行代码。查询正在运行,但我在网站的主页上看到一个类似打印。

请有人可以帮助我吗?

这是从 478 到 489 开始的代码行 adodb-mysql.inc.php

// returns true or false
function SelectDB($dbName)
{
    $this->database = $dbName;
    $this->databaseName = $dbName; # obsolete, retained for compat with older adodb versions
    if ($this->_connectionID) {
    @mysql_select_db($dbName,$this->_connectionID);
    $this->__db[$this->_connectionID] = $dbName;
    return $this->_connectionID;
}
else return false;
}

我真的希望你现在已经通过这里或其他网站上的另一个问题解决了这个问题。但希望这将帮助其他人在其他人之前偶然发现这个问题,例如严格标准:资源 ID#73 用作偏移量,转换为整数。

问题是$this->_connectionID是资源标识符。但是您将其用作数组中的简写作为整数。要将其转换为整数,可以使用以下内容。

$this->__db[(int)$this->_connectionID] = $dbName;