具有模块化扩展 (HMVC) 的 CodeIgniter 2.0 在 Linux 中未显示任何内容

发布于 2024-12-19 13:08:24 字数 1715 浏览 6 评论 0原文

*编辑得更清楚,

我正在两个环境中部署带有模块化扩展 (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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

始终不够 2024-12-26 13:08:24

您需要扩展 MX_Controller 而不是 CI_Controller

You need to extend MX_Controller not CI_Controller

天涯离梦残月幽梦 2024-12-26 13:08:24

如果您使用 wiredesignz 中的 HMVC 扩展,则需要验证将 MX 文件夹放入 application/third_party 文件夹和 MY_Loader.phpapplication/core 文件夹中的 MY_Router.php

验证完毕后,在 application 文件夹(“application/modules”)中创建文件夹 modules

现在,这个解决方案有一点棘手的是,当您不想创建模块时,默认控制器必须与模块命名相同 - 配置中指定的默认控制器名称不适用 在

这意味着,如果您创建一个名为“mymodule”的模块,您应该创建一个如下所示的文件夹/文件结构:

application/modules/mymodule
- /controllers
- - mymodule.php
- /views
- - whatever.php

控制器中,位于 application/modules/mymodule/controllers/mymodule.php 你只需创建一个控制器作为你通常会这样做:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Mymodule extends CI_Controller {

  public function index()
  {
    $this->load->view('whatever');
  }

}

If you are using the HMVC extension from wiredesignz you need to verify that you put the MX folder in the application/third_party folder and the MY_Loader.php and MY_Router.php in the application/core folder.

When this has been verified, create the folder modules in the application 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:

application/modules/mymodule
- /controllers
- - mymodule.php
- /views
- - whatever.php

In the controller, located at application/modules/mymodule/controllers/mymodule.php you just create a controller as you would normally do:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Mymodule extends CI_Controller {

  public function index()
  {
    $this->load->view('whatever');
  }

}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文