zend框架中所有控制器的基本控制器 [英] Base controller for all controllers in zend framework

查看:84
本文介绍了zend框架中所有控制器的基本控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是zend Framework的新手,我想问问是否有可能拥有一个可以被所有其他控制器扩展的基本控制器?我希望有一个基类,其中将为我在项目中拥有的所有控制器放置所有通用方法和属性。建议使用zend这样做还是有更好的方法呢?

I'm new to zend framework and I want to ask if is it possible to have a base controller that will be extended by all other controllers? I want to have a base class wherein I'll put all common methods and properties for all controllers I'll have on my project. Is it advisable to do this with zend or is there a better approach to this?

推荐答案

您可以创建一个基类,扩展Zend_Controller_Action。然后将其用作所有控制器的基类。

You could just make a base class which extends Zend_Controller_Action. Then use that as the base class for all of your controllers.

尽管根据您要执行的操作,将Action助手用作此类助手可能更合适每个控制器所需的功能。

Although, depending on what you want to do, it might be more appropriate to make Action helpers for the kind of functionality you want in every controller.

这篇关于zend框架中所有控制器的基本控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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