首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Pear Auth包

Pear Auth包
EN

Stack Overflow用户
提问于 2011-04-29 20:10:24
回答 2查看 1.8K关注 0票数 2

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

根据Pear网站的说法,DB包已经被弃用,取而代之的是MDB2。所以我安装了后一个(MDB2)包。

当我运行我的程序时,我得到了这个警告。

代码语言:javascript
复制
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行。有人能帮上忙吗?

代码语言:javascript
复制
 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;
    }
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-04-29 20:16:22

代码语言:javascript
复制
pear install --force --alldeps Auth

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

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

票数 2
EN

Stack Overflow用户

发布于 2013-09-09 19:01:30

不要强迫安装DB,它已经被弃用了!在以下代码中更改该行代码:

代码语言:javascript
复制
if (!MDB2::isConnection($this->db)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5831830

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档