加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – Codeigniter在“core”文件夹中查找库

发布时间:2020-12-13 17:24:30 所属栏目:PHP教程 来源:网络整理
导读:我使用ion_auth创建了这个Facebook应用程序.在某些浏览器中,当您授权应用程序时,它不会将用户登录到我的服务器上. 我检查了日志文件,发现了这个 ERROR - 2013-06-10 00:00:01 -- Severity: Warning -- include_once(application/core/MY_Ion_auth.php): fail
我使用ion_auth创建了这个Facebook应用程序.在某些浏览器中,当您授权应用程序时,它不会将用户登录到我的服务器上.

我检查了日志文件,发现了这个

ERROR - 2013-06-10 00:00:01 --> Severity: Warning  --> include_once(application/core/MY_Ion_auth.php): failed to open stream: No such file or directory /var/www/html/application/config/production/config.php 378
ERROR - 2013-06-10 00:00:01 --> Severity: Warning  --> include_once(): Failed opening 'application/core/MY_Ion_auth.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') /var/www/html/application/config/production/config.php 378

现在config.php第378行就像

function __autoload($class)
{
    if (strpos($class,'CI_') !== 0) {
        @include_once(APPPATH . 'core/' . $class . EXT);
    }
}

ion_auth和go2都是自动加载的库……它们实际上位于库文件夹中.

有任何想法吗?

解决方法

此库加载错误与旧版本的 __autoload method(允许您从应用程序/核心内自动加载自定义基本控制器)相关. config.php是此方法的正确/推荐位置.

旧版本的副作用是CI尝试在核心目录中查找您加载的任何自定义库.

解决方案是使用new version of the autoload method,即:

function __autoload($class)
{
    if (strpos($class,'CI_') !== 0)
    {
        if (file_exists($file = APPPATH . 'core/' . $class . EXT))
        {
            include $file;
        }

        elseif (file_exists($file = APPPATH . 'libraries/' . $class . EXT))
        {
            include $file;
        }
    }
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读