2
我遇到一個名爲'auth'(包含tank_auth認證庫)的模塊的配置文件的路徑問題。HMVC Codeigniter中配置文件的路徑(HMVC + Tank Auth)
的「身份驗證」模塊中的每個函數加載,加載在application/modules/auth/config/tank_auth.php
的tank_auth配置文件中的「tank_auth.php」庫:
function __construct()
{
$this->ci =& get_instance();
$this->ci->load->config('tank_auth', TRUE); //<--- HERE IT IS!!
$this->ci->load->library('session');
$this->ci->load->database();
$this->ci->load->model('tank_auth/users');
// Try to autologin
$this->autologin();
}
在另一個模塊,我插入下面的函數的調用在鑑於 '身份驗證' 模塊中:
<?php modules::run('auth/cp'); ?>
這讓我錯誤
An Error Was Encountered
The configuration file tank_auth.php does not exist.
我通過在Tank_auth.php中的__construct函數中更改內容來解決此問題,即從'tank_auth'到'auth/tank_auth'的路徑。
function __construct()
{
$this->ci =& get_instance();
$this->ci->load->config('auth/tank_auth', TRUE); // <--- ADDED module name
$this->ci->load->library('session');
$this->ci->load->database();
$this->ci->load->model('tank_auth/users');
// Try to autologin
$this->autologin();
}
我的問題是,爲什麼犯規正從另一模塊調用的權威性功能CP看到「權威性」模塊中的配置文件?不能在模塊的名稱中添加config('tank_auth', TRUE)
嗎?