如何在Codeigniter中创建两个父控制器? [英] How to create two parent controllers in Codeigniter?

查看:80
本文介绍了如何在Codeigniter中创建两个父控制器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建两个父控制器:一个用于管理员,一个用于用户站点。

I want to create two parent controllers: one for admin and one for user site. They have to extend a regular Controller class but each of them has to do different things.

推荐答案

我写了一篇文章,展示了如何你做这个。

I wrote up an article showing how you do this.

http://philsturgeon.co.uk/news/2010/02/CodeIgniter-Base-Classes-Keeping-it-DRY

您需要在config.php中创建一个__autoload()函数,或直接在类定义上包含基本控制器。

You need to create an __autoload() function in your config.php or directly include the base controller above the class definition.

这篇关于如何在Codeigniter中创建两个父控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆