Pear 认证包

发布于 2024-11-04 05:54:59 字数 1861 浏览 0 评论 0原文

在阅读 Larry Ullman 的 PHP 5 时,我被告知要安装 Pear Auth 包和 Pear DB。

据 Pear 网站称,DB 软件包已被弃用,取而代之的是 MDB2。所以我安装了后者(MDB2)包。

当我运行我的程序时,我收到此警告。

Fatal error: Class 'DB' not found in /Users/michaelmitchell/pear/share/pear/Auth/Container/DB.php on line 150

我不确定我是否做错了什么(如果是的话,是什么?),或者 Auth 包是否以某种方式引用了已弃用的 DB 类,或者其他什么?

if (!DB::isConnection($this->db) 下面的第三行是 DB.php 的第 150 行。有人可以帮忙吗?

 function _prepare()
    {
        if (!DB::isConnection($this->db)) {
            $res = $this->_connect($this->options['dsn']);
            if (DB::isError($res) || PEAR::isError($res)) {
                return $res;
            }
        }
        if ($this->options['auto_quote'] && $this->db->dsn['phptype'] != 'sqlite') {
            if (strpos('.', $this->options['table']) === false) {
                $this->options['final_table'] = $this->db->quoteIdentifier($this->options['table']);
            } else {
                $t = explode('.', $this->options['table']);
                for ($i = 0, $count = count($t); $i < $count; $i++)
                    $t[$i] = $this->db->quoteIdentifier($t[$i]);
                $this->options['final_table'] = implode('.', $t);
            }
            $this->options['final_usernamecol'] = $this->db->quoteIdentifier($this->options['usernamecol']);
            $this->options['final_passwordcol'] = $this->db->quoteIdentifier($this->options['passwordcol']);
        } else {
            $this->options['final_table'] = $this->options['table'];
            $this->options['final_usernamecol'] = $this->options['usernamecol'];
            $this->options['final_passwordcol'] = $this->options['passwordcol'];
        }
        return true;
    }

Reading Larry Ullman's PHP 5, I was told to install Pear Auth package and also Pear DB.

According to Pear website, the DB package has been deprecated in favor of MDB2. So I installed this latter (MDB2) package.

I'm getting this warning when I run my program.

Fatal error: Class 'DB' not found in /Users/michaelmitchell/pear/share/pear/Auth/Container/DB.php on line 150

I'm not sure if I have done something wrong (if so, what?) or if the Auth package is somehow referring to the deprecated DB class, or something else?

The third line below if (!DB::isConnection($this->db) is line 150 of DB.php. Can anyone help?

 function _prepare()
    {
        if (!DB::isConnection($this->db)) {
            $res = $this->_connect($this->options['dsn']);
            if (DB::isError($res) || PEAR::isError($res)) {
                return $res;
            }
        }
        if ($this->options['auto_quote'] && $this->db->dsn['phptype'] != 'sqlite') {
            if (strpos('.', $this->options['table']) === false) {
                $this->options['final_table'] = $this->db->quoteIdentifier($this->options['table']);
            } else {
                $t = explode('.', $this->options['table']);
                for ($i = 0, $count = count($t); $i < $count; $i++)
                    $t[$i] = $this->db->quoteIdentifier($t[$i]);
                $this->options['final_table'] = implode('.', $t);
            }
            $this->options['final_usernamecol'] = $this->db->quoteIdentifier($this->options['usernamecol']);
            $this->options['final_passwordcol'] = $this->db->quoteIdentifier($this->options['passwordcol']);
        } else {
            $this->options['final_table'] = $this->options['table'];
            $this->options['final_usernamecol'] = $this->options['usernamecol'];
            $this->options['final_passwordcol'] = $this->options['passwordcol'];
        }
        return true;
    }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

痕至 2024-11-11 05:54:59

执行

pear install --force --alldeps Auth

自动重新安装所有必需的依赖项。

在脚本中,确保 PEAR 位于配置的 include_path 中,并且可以由任何配置的自动加载器找到和/或手动包含所需的包。

Do

pear install --force --alldeps Auth

to automatically reinstall with all required dependencies.

In your script, make sure PEAR is in the configured include_path and can be found by any configured autoloaders and/or include the required packages manually.

时光暖心i 2024-11-11 05:54:59

不要强制安装 DB,它已被弃用!更改该行代码:

if (!MDB2::isConnection($this->db)

Don't force to install DB, it's deprecated! Change that line of code in:

if (!MDB2::isConnection($this->db)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文