答案 0 :(得分:1)
您可以按照以下步骤执行此操作:
Stpep 1)在控制器文件夹中创建子文件夹"superadmin"
,如下所示:
controllers/superadmin
Stpep 2)在子文件夹controllers/superadmin/loginvalueget.php
中创建控制器"superadmin"
,如下所示:
<?php
class Loginvalueget extends CI_Controller {
function index()
{
die('hello world');
}
}
?>
步骤3)更改application/config/routes.php
中的默认控制器路由,如下所示:
$route['default_controller'] = 'superadmin/loginvalueget';
步骤4)用system/core/Router.php
中的以下方法替换_set_default_controller():
protected function _set_default_controller()
{
if (empty($this->default_controller))
{
show_error('Unable to determine what should be displayed. A default route has not been specified in the routing file.');
}
// Is the method being specified?
$x = explode('/', $this->default_controller);
$dir = APPPATH.'controllers';
$dir_arr = array();
foreach($x as $key => $val){
if(!is_dir($dir.'/'.$val)){
if(file_exists($dir.'/'.ucfirst($val).'.php')){
$class = $val;
if(array_key_exists(($key+1), $x)){
$method = $x[$key+1];
}else{
$method = 'index';
}
}else{
show_error('Not found specified default controller : '. $this->default_controller);
}
break;
}
$dir_arr[] = $val;
$dir = $dir.'/'.$val;
}
//set directory
$this->set_directory(implode('/', $dir_arr));
$this->set_class($class);
$this->set_method($method);
// Assign routed segments, index starting from 1
$this->uri->rsegments = array(
1 => $class,
2 => $method
);
log_message('debug', 'No URI present. Default controller set.');
}
答案 1 :(得分:0)
您可以在附件中看到自己,但未设置路线。您可以通过在“application&gt; config&gt; routes.php”中设置路径路径来完成此操作。