0

尝试自动加载 ion_auth 库时出现错误

应用程序/配置/autoload.php

$autoload['libraries'] = array('database', 'template', 'asset', 'ion_auth/ion_auth'); 

文件夹结构:

application/
  ...
  modules/
    ion_auth/
      ...
      config/
        ion_auth.php
      ...
    tester/
      controllers/
        tester.php 

我尝试在 tester.php 上 var_dump($this->ion_auth) 并收到错误消息:

The configuration file ion_auth.php does not exist.

我尝试从 tester.php 中 $this->load->library('ion_auth/ion_auth') 并从自动加载中删除 ionauth,它仍然是错误的。如何解决这个问题?

我从 codeigniter.com 上的链接下载 codeigniter 并从 bitbucket 下载 Modular Extension

4

3 回答 3

2

这不是模块化扩展的问题。您需要将 Ion Auth 的配置文件放入主应用程序的 config 文件夹,而不是 Ion Auth 目录。

只需将其从application/modules/ion_auth/config/ion_auth.php移至application/config/ion_auth.php。这将解决配置错误,但您可能需要将整个 Ion Auth 库移动到application/libraries.

于 2011-08-05T18:42:04.367 回答
0

我和你做的完全一样,来自wiredesignz、CI和Ion_auth的HMVC,我也遇到了同样的问题。我解决了它在库之前加载配置文件,:P,我不知道这是否是你的问题,但我也有完全相同的错误消息。我的 Ion_auth 构造方法看起来像

class Auth extends MY_Controller {

function __construct()
{
    parent::__construct();

    // THIS LINE BEFORE LOAD THE LIBRARY:
    $this->load->config('auth/ion_auth', TRUE);

    $this->load->library('ion_auth');
    $this->load->library('session');
    $this->load->library('form_validation');
    $this->form_validation->CI = & $this;
    $this->load->database();
    $this->load->helper('url');
    $this->load->helper('cookie');

    $this->load->library('email');
    $this->load->library('session');
    $this->lang->load('auth/ion_auth');
    $this->load->model('auth/ion_auth_model');      
}
于 2013-04-02T18:49:51.230 回答
0

我不使用模块化扩展,但从您的代码的外观来看,我敢猜测 CI 不知道在 ion_auth 文件夹中查找 config 文件夹。

如果 Modular Extensions 有配置选项,请确保将其设置为在扩展的文件夹中查找配置文件夹。如果没有,您需要直接告诉 CI 配置文件夹,或者将 ion_auth 配置文件放入可识别的配置文件夹中。

于 2011-08-05T17:00:33.563 回答