Codeigniter hmvc无法加载请求的文件

时间:2016-04-27 06:54:02

标签: codeigniter hmvc

我们使用:

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

可能是什么问题?

1 个答案:

答案 0 :(得分:0)

如果你使用来自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/'
);
之后你应该能够通过你的请求获得你的请求 /输入/ part1的/ yourFunction中/