【问题标题】:Codeigniter HMVC is ignoring sub dirs cq. config linesCodeigniter HMVC 忽略子目录 cq。配置行
【发布时间】:2013-04-14 20:25:14
【问题描述】:

我对@9​​87654321@ 的 HMVC 模块有些苦恼

重点是:似乎每个人都可以在 HMVC 中使用子目录(例如这里:here),方法是将其添加到 /application/config/config.php 中的 config.php 文件中:

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

但是,它对我不起作用。似乎这条线被完全忽略了。

我尝试过的:

制作了以下文件:

-modules
    -- foo
    -- -- controllers
    -- -- -- test.php

    -- test
    -- -- bar
    -- -- -- controllers
    -- -- -- -- baz.php

foo/test 有效,即使我删除了完整的 $config['modules_locations'] 行。但 test/bar/baz 没有。

Wiredesignz 的联机帮助页说:

Modules::$locations 数组可以在 application/config.php 中设置 文件。

这似乎是一个错字(application/config/config.php 更符合逻辑),但我什至尝试过(但没有运气)。

这里出了什么问题?

Tnx :)

编辑:“它不起作用”我的意思是我得到了 404。

【问题讨论】:

  • 尝试将最长路径放在您的配置中,看看是否有任何不同。
  • @WahyuKristianto:因为我想将管理模块与其他模块分开。
  • @ahmad 不,没有区别。

标签: php codeigniter hmvc


【解决方案1】:

除非根据许多论坛关于这个主题,只有一种正确的方法来设置你的 /application/config.php 文件:

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

设置后,我可以从 domain.com/index.php/baz 上的示例访​​问控制器 baz(不是 /test/baz,也可以通过为其添加路由来实现。)

【讨论】:

    猜你喜欢
    • 2015-01-27
    • 1970-01-01
    • 1970-01-01
    • 2012-09-16
    • 1970-01-01
    • 2010-11-08
    • 1970-01-01
    • 2023-03-20
    • 2011-09-11
    相关资源
    最近更新 更多