简体   繁体   English

Zend_Application与扩展Frontcontroller和使用扩展的Frontcontroller应用程序资源有关

[英]Zend_Application issue with extending Frontcontroller and using extended Frontcontroller application resource

I extended the Zend Frontcontroller with a personal one and also extended the frontcontroller application resource to use my personal front controller. 我使用个人扩展了Zend Frontcontroller并扩展了前控制器应用程序资源以使用我的个人前端控制器。 All it basically does for the moment is assign the front variable within the application resource method getFrontController to my personal front controller. 它目前基本上只是将应用程序资源方法getFrontController的前端变量分配给我的个人前端控制器。 Lastly, I added the pluginpaths variable within application.ini to use my personal Application Resources. 最后,我在application.ini添加了pluginpaths变量以使用我的个人应用程序资源。 In any case, I'm getting the Zend Frontcontroller returned to me instead of my personal one. 在任何情况下,我都会让Zend Frontcontroller返回给我,而不是我个人的。 Anybody know why my personal application frontcontroller resource isnt being used? 有人知道为什么我的个人应用程序前控制器资源没有被使用? ` `

Since Zend_Controller_Front is a singleton, you will also need to override the getInstance() method to ensure it creates an instance of your class instead of the base class. 由于Zend_Controller_Front是单例,因此您还需要覆盖getInstance()方法以确保它创建类的实例而不是基类。 You can just cut and paste the method to do this: 您可以剪切并粘贴方法来执行此操作:

public static function getInstance()
{
    if (null === self::$_instance) {
        self::$_instance = new self();
    }

    return self::$_instance;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM