在我的MY_Loader上进行codeigniter。我又给了它一个我已经解决了一部分我已经找到了如何定义前端网址
但似乎无法让管理员完成。
它会引发火狐页面加载错误。
The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.This problem can sometimes be caused by disabling or refusing to accept cookies.
在 HTTP_SERVER 区域中,您会看到我已尝试获取基本网址和其他网址的两个选项。
<?php (defined('BASEPATH')) OR exit('No direct script access allowed');
/* load the MX_Loader class */
require APPPATH."third_party/hmvc/loader.php";
class MY_Loader extends MX_Loader {
public function __construct() {
// Backend url calling not working.
// Tried But no luck.
$SERVER_URL = config_item('base_url');
$HTTP_SERVER = explode('/', $SERVER_URL);
$admin = end($HTTP_SERVER);
$myLastElement = end($HTTP_SERVER);
$admin = str_replace("/admin","",$SERVER_URL);
define('HTTP_SERVER', $admin);
// Tried But no luck.
define('HTTP_SERVER', config_item('base_url'));
// Working Gets front main.
$CATALOG_URL = config_item('base_url');
$HTTP_CATALOG = explode('/', $CATALOG_URL);
$myLastElement = end($HTTP_CATALOG);
$home = str_replace("admin/","",$CATALOG_URL);
define('HTTP_CATALOG', $home);
$this->_ci_view_paths = array(APPPATH . 'views/template/' => TRUE);
$this->_ci_ob_level = ob_get_level();
$this->_ci_library_paths = array(APPPATH, BASEPATH);
$this->_ci_helper_paths = array(APPPATH, BASEPATH);
$this->_ci_model_paths = array(APPPATH);
log_message('debug', "MY_Loader Class Initialized");
}
}
答案 0 :(得分:0)
在我的仪表板上,我没有设置正确的会话检查认为这是冲突。我现在似乎可以使用这个OK定义('HTTP_SERVER',config_item('base_url'));将在MY_loader.php上进行更多测试。
新
public function __construct(){
parent::__construct();
$this->load->library('user');
$this->lang->load('english', 'english');
$this->lang->load('common/dashboard', 'english');
if($this->session->userdata('user_id')) {
return true;
} else {
return false;
redirect('login');
}
}
<强> OLD 强>
public function __construct(){
parent::__construct();
$this->load->library('user');
$this->lang->load('english', 'english');
$this->lang->load('common/dashboard', 'english');
if($this->session->userdata('user_id') == false) {
if (array_key_exists('warning', $this->error)) {
$data['error_warning'] = "Session Has Expired Please Login";
} else {
$data['error_warning'] = '';
}
redirect('login');
return !$error;
}
}