无法在Codeigniter上加载默认控制器 [英] unable to load your default controller on Codeigniter

查看:247
本文介绍了无法在Codeigniter上加载默认控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我遇到的错误。


请确保在Routes.php文件中指定的控制器有效。 / p>

Please make sure the controller specified in your Routes.php file is valid.

让我解释一下。
在我的应用程序中,我使用了HMVC。在我的application文件夹中有两个文件夹back-modules和front-modules。在我的front-modules文件夹中有一个名为 home的文件夹,其中包含控制器,模块和视图。

Let me explain this. In my application i have used HMVC. In my application folder there are two folders back-modules and front-modules.in my front-modules folder there is a folder called "home" and it has controllers,modules and views.


controllers-> home.php

controllers->home.php

这是我的home.php

this is my home.php

  class Home extends MX_Controller{
    public function __construct(){
    parent::__construct();
    $this->load->helper(array('form'));
  }

    public function index(){                
    $this->template->build('home');
   }
  }

这是我的routes.php

and this is my routes.php

$route['default_controller'] = "home";
$route['404_override'] = '';

当我尝试访问该网站时,会出现此错误

when i try to go to the site, it gives this error


无法在Codeigniter上加载默认控制器。请确保在Routes.php文件中指定的控制器有效。

unable to load your default controller on Codeigniter.Please make sure the controller specified in your Routes.php file is valid.

此系统在localhost上运行良好。

this system works fine on localhost.

请有人帮忙解决此问题。

Someone please help me in this matter.

推荐答案

根据codegniter手册管理多应用程序

According to codegniter manual managing multi application

在您的index.php文件更改中

in your index.php file change

$application_folder = 'application';

$application_folder = 'application/home';

并确保控制器文件名以大写字母开头

and make sure the controller file name starts with capital letter

controllers->Home.php

并保留Routes.php配置

and keep Routes.php configurations

$route['default_controller'] = "home";

这篇关于无法在Codeigniter上加载默认控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆