2016-04-27 93 views
1

我們使用:笨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/', 
); 

application/modules/input/part1/Part1.php

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

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

/配置/ 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 

可能是什麼問題?

+0

檢查頁面roytuts.com/setup-hmvc-with-codeigniter-3/ – user3470953

回答

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/' 
); 

後,你應該能夠通過 得到您的要求/ input/part1/yourfunction/