1

我的 CI2 应用程序正在使用 wiredesigns 模块化布局。

我在一个名为 modules 的文件夹中有一个名为 item 和 product 的两个模块,如下所示:

/application
    /modules
        /item
        /product

在 Item 中,我有一个名为 item 的控制器,它的开头是这样的。

class Item extends MX_Controller
{
    //code here
}

我需要做什么才能使我的产品控制器在不同的模块中扩展我的项目控制器

4

1 回答 1

1

我的猜测是你正试图让你的代码“干燥”(http://en.wikipedia.org/wiki/Don't_repeat_yourself),这在 CI 中意味着使用像 My_Controller 这样的通用控制器(参见:http://ellislab. com/codeigniter/user-guide/general/core_classes.html)。

查看 Phil Sturgeon 的观点:http: //philsturgeon.co.uk/blog/2010/02/CodeIgniter-Base-Classes-Keeping-it-DRY

于 2012-12-21T18:20:53.580 回答