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

    <legend id='4fFHV'><style id='4fFHV'><dir id='4fFHV'><q id='4fFHV'></q></dir></style></legend>

      1. <tfoot id='4fFHV'></tfoot>
          <bdo id='4fFHV'></bdo><ul id='4fFHV'></ul>
      2. 在 Zend 中使用 BaseController 扩展 IndexController

        Extending the IndexController with a BaseController in Zend(在 Zend 中使用 BaseController 扩展 IndexController)
        <legend id='sMovn'><style id='sMovn'><dir id='sMovn'><q id='sMovn'></q></dir></style></legend>
        <i id='sMovn'><tr id='sMovn'><dt id='sMovn'><q id='sMovn'><span id='sMovn'><b id='sMovn'><form id='sMovn'><ins id='sMovn'></ins><ul id='sMovn'></ul><sub id='sMovn'></sub></form><legend id='sMovn'></legend><bdo id='sMovn'><pre id='sMovn'><center id='sMovn'></center></pre></bdo></b><th id='sMovn'></th></span></q></dt></tr></i><div id='sMovn'><tfoot id='sMovn'></tfoot><dl id='sMovn'><fieldset id='sMovn'></fieldset></dl></div>
          <tbody id='sMovn'></tbody>

          1. <small id='sMovn'></small><noframes id='sMovn'>

            <tfoot id='sMovn'></tfoot>
                <bdo id='sMovn'></bdo><ul id='sMovn'></ul>
                  本文介绍了在 Zend 中使用 BaseController 扩展 IndexController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试使用全局基本控制器来扩展我的控制器:

                  I'm trying to extend my controllers with a global base controller as such:

                  class BaseController extends Zend_Controller_Action {
                   // common controller actions
                      public function listAction() {
                          // do stuff
                      }
                  }
                  
                  class IndexController extends BaseController {
                   // index controller specific actions
                  }
                  
                  class LoginController extends BaseController {
                   // login controller specific actions
                  }
                  

                  但我收到此错误:PHP 致命错误:在第 3 行的/var/www/Zend/project/application/controllers/IndexController.php 中找不到类BaseController"

                  But I get this error: PHP Fatal error: Class 'BaseController' not found in /var/www/Zend/project/application/controllers/IndexController.php on line 3

                  关于如何让 Zend看到"这个控制器的任何想法?

                  Any ideas on how to get Zend to "see" this controller?

                  推荐答案

                  Autoloader

                  设置自动加载器并使用自动加载器注册除了 Zend 库之外的库(在设置包含路径后在 bootstrap.php 中):

                  Autoloader

                  Setup the autoloader and register your library which should be besides the Zend library with the autoloader like so (in your bootstrap.php after setting the include path):

                  //AutoLoad loads classes automatically if they are used
                  require_once 'Zend/Loader/Autoloader.php';
                  $loader = Zend_Loader_Autoloader::getInstance();
                  $loader->registerNamespace('Mylibrary_');
                  

                  Zend 命名约定

                  那么你应该按如下方式重命名你的 BaseController

                  Zend naming conventions

                  Then you should rename your BaseController as follows

                  /Zend (folder)
                  /Mylibrary (folder)
                      /Controller (folder)
                          Action.php <-- this is your basecontroller file
                  

                  其中包含:

                  class Mylibrary_Controller_Action extends Zend_Controller_Action
                  {
                  }
                  

                  和控制器文件夹中的普通控制器:

                  and your normal controllers in the controller folder:

                  class IndexController extends Mylibrary_Controller_Action
                  {
                  }
                  

                  所以基本上当你想扩展框架时,你可以在自己的库中保留一个并行结构.

                  so basically when you want to extend the framework you keep a parallel structure in your own library.

                  这篇关于在 Zend 中使用 BaseController 扩展 IndexController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Appending GET parameters to URL from lt;formgt; action(将 GET 参数附加到来自 lt;formgt; 的 URL行动)
                  Forcing quot;Save Asquot; dialog via jQuery GET(强制“另存为通过 jQuery GET 对话框)
                  PHP - get certain word from string(PHP - 从字符串中获取某个单词)
                  How to debug a get request in php using curl(如何使用 curl 在 php 中调试 get 请求)
                  get a # from a url in php(从 php 中的 url 获取 #)
                  PHP - include() file not working when variables are put in url?(PHP - 将变量放入 url 时,include() 文件不起作用?)
                    <legend id='OrEdv'><style id='OrEdv'><dir id='OrEdv'><q id='OrEdv'></q></dir></style></legend>

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

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

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

                              <tbody id='OrEdv'></tbody>