具有模块化扩展 (HMVC) 的 CodeIgniter 2.0 在 Linux 中未显示任何内容
*编辑得更清楚,
我正在两个环境中部署带有模块化扩展 (HMVC) 的 CI 2.0.3,一个是 Windows(用于开发),另一个是 Linux(用于生产)。两个环境具有相同的文件夹和文件结构。目前我遇到了问题。
按照手册将模块化扩展集成到 CI 后。我做的第一件事是将 CI 附带的默认欢迎 MVC 迁移到模块化扩展 HMVC。两个环境均已成功迁移,并且可以在浏览器上查看。
但是当我创建其他模块时,它在Windows环境下工作,但在Linux环境下不起作用。在 Windows 上,当我调用该模块时,浏览器会按预期显示页面。但在 Linux 上它只显示白色的空白页。甚至没有 404 错误页面,这意味着它不是一个损坏的链接。
谁能告诉我 CI 有什么问题吗?
目录结构
/application
-/cache
-/config
-/controllers
-/core
--MY_Loader.php
--MY_Router.php
-/errors
-/helpers
-/hooks
-/language
--/english
-/libraries
-/logs
-/models
-/modules
--/csv_game_credit
---/controllers
----csv_game_credit.php
---/models
----csv_game_credit_db.php
---/views
----welcome_message.php
--/welcome
---/controllers
----welcome.php
---/views
----welcome_message.php
-/third_party
--/MX
--Base.php
--Ci.php
--Config.php
--Controller.php
--Lang.php
--Loader.php
--Modules.php
--Router.php
-/views
Welcome 控制器
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Welcome extends CI_Controller {
public function index()
{
$this->load->view('welcome_message');
}
}
Csv_game_credit 控制器
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Csv_game_credit extends CI_Controller {
function __construct() {
parent::__construct();
$this->load->model('Csv_game_credit_db');
$this->load->dbutil();
$this->load->helper('file');
}
public function index()
{
$this->load->view('welcome_message');
}
}
这和Linux的文件夹权限有关系吗?我会尝试将文件夹权限更改为777并更新你们
之前谢谢
*edited to be more clearly
I'm deploying CI 2.0.3 with Modular Extensions (HMVC) in two environments, one is Windows -for development- and the other is Linux -for production-. Both environment has identically folders and files structure. Currently I am having a problem.
After integrating the Modular Extensions to CI by following the manual. The first thing I did was moving the default Welcome MVC that comes with CI to Modular Extensions HMVC. Both environment successfully moved and can be viewed on the browser.
But when I create other modules, it worked on Windows environment but not on Linux. On Windows when I call the module the browser shows the page as expected. But on Linux it shows just white blank page. Not even an 404 err page, which means it is not a broken link.
Can anyone tells me what is wrong in the CI?
Directory structure
/application
-/cache
-/config
-/controllers
-/core
--MY_Loader.php
--MY_Router.php
-/errors
-/helpers
-/hooks
-/language
--/english
-/libraries
-/logs
-/models
-/modules
--/csv_game_credit
---/controllers
----csv_game_credit.php
---/models
----csv_game_credit_db.php
---/views
----welcome_message.php
--/welcome
---/controllers
----welcome.php
---/views
----welcome_message.php
-/third_party
--/MX
--Base.php
--Ci.php
--Config.php
--Controller.php
--Lang.php
--Loader.php
--Modules.php
--Router.php
-/views
Welcome controller
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Welcome extends CI_Controller {
public function index()
{
$this->load->view('welcome_message');
}
}
Csv_game_credit controller
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Csv_game_credit extends CI_Controller {
function __construct() {
parent::__construct();
$this->load->model('Csv_game_credit_db');
$this->load->dbutil();
$this->load->helper('file');
}
public function index()
{
$this->load->view('welcome_message');
}
}
Is this has something to do with the Linux's folder permission? I will try to change the folder permission to 777 and update you guys
Thanks before
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要扩展 MX_Controller 而不是 CI_Controller
You need to extend MX_Controller not CI_Controller
如果您使用 wiredesignz 中的 HMVC 扩展,则需要验证将
MX
文件夹放入application/third_party
文件夹和MY_Loader.php
中application/core
文件夹中的MY_Router.php
。验证完毕后,在
application
文件夹(“application/modules”)中创建文件夹modules
。现在,这个解决方案有一点棘手的是,当您不想创建模块时,默认控制器必须与模块命名相同 - 配置中指定的默认控制器名称不适用 在
这意味着,如果您创建一个名为“mymodule”的模块,您应该创建一个如下所示的文件夹/文件结构:
控制器中,位于
application/modules/mymodule/controllers/mymodule.php
你只需创建一个控制器作为你通常会这样做:If you are using the HMVC extension from wiredesignz you need to verify that you put the
MX
folder in theapplication/third_party
folder and theMY_Loader.php
andMY_Router.php
in theapplication/core
folder.When this has been verified, create the folder
modules
in theapplication
folder ('application/modules`).Now, what is a little tricky about this solution is that when you wan't to create a module, the default controller has to be named the same as the module - the default controller name specified in the config doesn't apply here.
This means that if you create a module called `mymodule', you should create a folder/file structure like this:
In the controller, located at
application/modules/mymodule/controllers/mymodule.php
you just create a controller as you would normally do: