【问题标题】:Codeigniter hmvc Unable to load the requested fileCodeigniter hmvc 无法加载请求的文件
【发布时间】:2016-04-27 18:11:47
【问题描述】:

我们使用:

PHP5.6.14  

WINDOWS 7 

Codeigniter 3.0.6 

[Codeigniter HMVC][1]  

我们的项目结构:

application  
----modules  
--------auth  
------------controllser  
------------models  
------------views  
--------input  
------------part1  
----------------controllers  
--------------------Part1.php  
----------------models  
----------------views  
--------------------index.php  
------------part2  
----------------controllers  
----------------models  
----------------views  
--------othermodule  
------------controllser  
------------models  
------------views  

application/config/config.php 我们添加

$config['modules_locations'] = array(
    APPPATH.'modules/' => '../modules/',
    APPPATH.'modules/input/' => '../modules/input/',
);

应用程序/模块/输入/part1/Part1.php

class Part1 extends MX_Controller
{
    public function __construct()
    {
        parent::__construct();
    }

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

application/config/routes.php 我们没有改变任何东西

.htaccess

AddDefaultCharset utf-8

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]

</IfModule>

http://musite.ru/part1 我们看到错误:

An Error Was Encountered

Unable to load the requested file: index.php

可能是什么问题?

【问题讨论】:

  • 查看页面 roytuts.com/setup-hmvc-with-codeigniter-3/

标签: codeigniter hmvc


【解决方案1】:

如果您使用来自wiredesignz 的hmvc 你的结构应该是这样的

application  
----modules  
--------auth  
------------controllser  
------------models  
------------views  
--------input  
------------controllers
----------------Part1.php
----------------Part2.php
------------models  
------------views  
----------------part1
--------------------index.php
----------------part2
--------------------index.php
--------othermodule  
------------controllser  
------------models  
------------views  

你的 config.php 应该是这样的

$config['modules_locations'] = array(
    APPPATH.'modules/' => '../modules/'
);

之后,您应该能够通过 /input/part1/yourfunction/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-05-25
    • 2018-07-20
    • 2017-09-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-13
    • 1970-01-01
    相关资源
    最近更新 更多