1. <legend id='GsQ5d'><style id='GsQ5d'><dir id='GsQ5d'><q id='GsQ5d'></q></dir></style></legend>
        <bdo id='GsQ5d'></bdo><ul id='GsQ5d'></ul>
      <tfoot id='GsQ5d'></tfoot>
      <i id='GsQ5d'><tr id='GsQ5d'><dt id='GsQ5d'><q id='GsQ5d'><span id='GsQ5d'><b id='GsQ5d'><form id='GsQ5d'><ins id='GsQ5d'></ins><ul id='GsQ5d'></ul><sub id='GsQ5d'></sub></form><legend id='GsQ5d'></legend><bdo id='GsQ5d'><pre id='GsQ5d'><center id='GsQ5d'></center></pre></bdo></b><th id='GsQ5d'></th></span></q></dt></tr></i><div id='GsQ5d'><tfoot id='GsQ5d'></tfoot><dl id='GsQ5d'><fieldset id='GsQ5d'></fieldset></dl></div>

        <small id='GsQ5d'></small><noframes id='GsQ5d'>

      1. 有一个 BaseController 并使所有控制器都扩展该类是个好主意吗?

        时间:2023-05-30
          <bdo id='Tl95o'></bdo><ul id='Tl95o'></ul>
        • <i id='Tl95o'><tr id='Tl95o'><dt id='Tl95o'><q id='Tl95o'><span id='Tl95o'><b id='Tl95o'><form id='Tl95o'><ins id='Tl95o'></ins><ul id='Tl95o'></ul><sub id='Tl95o'></sub></form><legend id='Tl95o'></legend><bdo id='Tl95o'><pre id='Tl95o'><center id='Tl95o'></center></pre></bdo></b><th id='Tl95o'></th></span></q></dt></tr></i><div id='Tl95o'><tfoot id='Tl95o'></tfoot><dl id='Tl95o'><fieldset id='Tl95o'></fieldset></dl></div>

        • <tfoot id='Tl95o'></tfoot>

            <tbody id='Tl95o'></tbody>

              1. <legend id='Tl95o'><style id='Tl95o'><dir id='Tl95o'><q id='Tl95o'></q></dir></style></legend>

                <small id='Tl95o'></small><noframes id='Tl95o'>

                  本文介绍了有一个 BaseController 并使所有控制器都扩展该类是个好主意吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我需要所有控制器中的一些通用行为.有一个 BaseController 并使所有控制器都扩展该类是个好主意吗?如果是这样,避免 Fatal error: Class 'BaseController' not found 错误的正确方法是什么.

                  I need some common behaviors in all controllers. Is a good idea have a BaseController and make all controllers extend that class? If so, What is the correct way to avoid the Fatal error: Class 'BaseController' not found error.

                  推荐答案

                  这当然是一种常见的方法.

                  It's certainly a common approach.

                  但是一篇文章由采埃孚项目负责人 Matthew Weier O'Phinney 撰写 解释了 action-helpers 如何以更大的灵活性提供相同的好处.

                  But an article by ZF project lead Matthew Weier O'Phinney explains how action-helpers can provide the same benefits with more flexibility.

                  特别是,一个通用的基本控制器通常会成为多个但并非全部控制器中使用的功能的倾倒场,因此它变得矫枉过正.动作助手是一种延迟加载的替代方案,可在您需要的时间和地点准确调用功能.

                  In particular, a common base controller often becomes a dumping ground for functionality that is used in multiple-but-not-all controllers, so it become overkill. Action-helpers are kind of a lazy-load alternative, invoking functionality precisely when and where you need it.

                  此外,action-helper 调度钩子 - init(), preDispatch()postDispatch() - 允许你自动化插件- 基于每个控制器的类似功能.

                  Also, the action-helper dispatch hooks - init(), preDispatch() and postDispatch() - allow you to automate plugin-like functionality on a per-controller basis.

                  我会去行动助手.但与大多数事情一样,YMMV.;-)

                  I'd go action-helpers. But as with most things, YMMV. ;-)

                  这篇关于有一个 BaseController 并使所有控制器都扩展该类是个好主意吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:ZF2 如何 orWhere() 下一篇:Zend_Validate: Db_NoRecordExists with Doctrine

                  相关文章

                1. <legend id='lxcyC'><style id='lxcyC'><dir id='lxcyC'><q id='lxcyC'></q></dir></style></legend>

                    <bdo id='lxcyC'></bdo><ul id='lxcyC'></ul>

                      <tfoot id='lxcyC'></tfoot>
                    1. <small id='lxcyC'></small><noframes id='lxcyC'>

                    2. <i id='lxcyC'><tr id='lxcyC'><dt id='lxcyC'><q id='lxcyC'><span id='lxcyC'><b id='lxcyC'><form id='lxcyC'><ins id='lxcyC'></ins><ul id='lxcyC'></ul><sub id='lxcyC'></sub></form><legend id='lxcyC'></legend><bdo id='lxcyC'><pre id='lxcyC'><center id='lxcyC'></center></pre></bdo></b><th id='lxcyC'></th></span></q></dt></tr></i><div id='lxcyC'><tfoot id='lxcyC'></tfoot><dl id='lxcyC'><fieldset id='lxcyC'></fieldset></dl></div>