我将my_controller.php的问题仍然存在,当我将我的配置项设置为true以进行system_maintenance时它重定向到URL页面确定,但显示Firefox重定向错误页面未正确重定向不能似乎加载实际页面。路线设置正确。我也试图从URL中删除维护这个词,只显示主URL,但在设置为true时仍然会重定向到维护URL。
如果config_item('system_maintenance')设置为FALSE可以看到页面正常,但应该工作在TRUE而不是false
Maintenance.php控制器
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Maintenance extends Catalog_Controller {
public function __construct(){
parent::__construct();
}
public function index() {
$this->load->model('admin/users_model');
if($this->users_model->isLogged()) {
return $this->info();
}
}
public function info() {
$this->lang->load('catalog/maintenance', 'english');
$data['title'] = $this->lang->line('heading_title');
$data['heading_title'] = $this->lang->line('heading_title');
$data['breadcrumbs'] = array();
$data['breadcrumbs'][] = array(
'text' => $this->lang->line('text_maintenance'),
'href' => site_url('catalog/common/maintenance')
);
$this->load->view('theme/default/template/common/maintenance', $data);
}
}
CONFIG.PHP
/*
|--------------------------------------------------------------------------
| Checks If System Is Installed
|--------------------------------------------------------------------------
|
| Typically this will be set to FALSE on the main application directory if
| you have not set up via the install wizard. You must use install wizard to set up.
| You will not be able to view website if main application system_installed is set to FALSE MY_Controller System Check.
|
*/
$config['system_installed'] = TRUE;
/*
|--------------------------------------------------------------------------
| Checks If System Is Maintenance Mode
|--------------------------------------------------------------------------
|
| This system check makes sure user gets redirected to maintenane
| page. If set to true and allow access if set false.
|
|
*/
$config['system_maintenance'] = TRUE;
我的控制器
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Controller extends MX_Controller {
public function __construct() {
parent::__construct();
}
}
class Catalog_Controller extends MY_Controller {
public function __construct() {
parent::__construct();
if(config_item('maintenance')) redirect('maintenance');
}
}
class Admin_Controller extends MY_Controller {
public function __construct() {
parent::__construct();
if(!config_item('system_installed')) redirect('install');
}
}
答案 0 :(得分:0)
发现我自己的答案似乎在没有空间全部工作时起作用。
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Controller extends MX_Controller {
public function __construct() {
parent::__construct();
if(!config_item('system_installed')) redirect('install');
}
}
class CatalogController extends MY_Controller {
public function __construct() {
parent::__construct();
if($this->config->item('system_maintenance') == TRUE) {
redirect('maintenance');
}
}
}