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

      <tfoot id='6Qtek'></tfoot>
      <legend id='6Qtek'><style id='6Qtek'><dir id='6Qtek'><q id='6Qtek'></q></dir></style></legend>
    1. <small id='6Qtek'></small><noframes id='6Qtek'>

      • <bdo id='6Qtek'></bdo><ul id='6Qtek'></ul>
      1. 有一个 BaseController 并使所有控制器都扩展该类是

        时间:2023-10-02
          <bdo id='14hYx'></bdo><ul id='14hYx'></ul>
          <tfoot id='14hYx'></tfoot>

          <small id='14hYx'></small><noframes id='14hYx'>

              <i id='14hYx'><tr id='14hYx'><dt id='14hYx'><q id='14hYx'><span id='14hYx'><b id='14hYx'><form id='14hYx'><ins id='14hYx'></ins><ul id='14hYx'></ul><sub id='14hYx'></sub></form><legend id='14hYx'></legend><bdo id='14hYx'><pre id='14hYx'><center id='14hYx'></center></pre></bdo></b><th id='14hYx'></th></span></q></dt></tr></i><div id='14hYx'><tfoot id='14hYx'></tfoot><dl id='14hYx'><fieldset id='14hYx'></fieldset></dl></div>
                <tbody id='14hYx'></tbody>
                • <legend id='14hYx'><style id='14hYx'><dir id='14hYx'><q id='14hYx'></q></dir></style></legend>
                • 本文介绍了有一个 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 并使所有控制器都扩展该类是个好主意吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:我可以预测我的 Zend Framework 索引有多大吗?(以及 下一篇:Zend_Validate: Db_NoRecordExists with Doctrine

                  相关文章

                  最新文章

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

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

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