无法在Codeigniter上加载默认控制器

编程入门 行业动态 更新时间:2024-10-20 21:03:53
本文介绍了无法在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上加载默认控制器

本文发布于:2023-11-01 02:14:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1547952.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:控制器   加载   Codeigniter

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!