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 并使所有控制器都扩展该类是个好主意吗?

        Is a good idea have a BaseController and make all controllers extend that class?(有一个 BaseController 并使所有控制器都扩展该类是个好主意吗?)
          <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 并使所有控制器都扩展该类是个好主意吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                      <tbody id='lxcyC'></tbody>
                    <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>