Zend framework 正在尝试禁用zend中的布局

Zend framework 正在尝试禁用zend中的布局,zend-framework,layout,Zend Framework,Layout,我尝试通过以下方式禁用zend action中的布局: $this->_helper->layout->disableLayout(); 但它不起作用: Fatal error: Call to undefined method Application_Controller_Helper_Layout::disableLayout() in application/controllers/AssetController.php on line 18 我想是的,因为我有自己

我尝试通过以下方式禁用zend action中的布局:

$this->_helper->layout->disableLayout();
但它不起作用:

 Fatal error: Call to undefined method Application_Controller_Helper_Layout::disableLayout() in application/controllers/AssetController.php on line 18
我想是的,因为我有自己的帮手

Bootsrap.php

application.ini

resources.frontController.actionhelperpaths.Application_Controller_Helper = APPLICATION_PATH "/controllers/helpers"
我的助手呢

class Application_Controller_Helper_Layout extends Zend_Controller_Action_Helper_Abstract
{
    public function preDispatch()
    {
    }
}

谢谢

如果要重写Zend default layout helper,请扩展Zend_layout_Controller_Action_helper_layout

class Application_Controller_Helper_Layout extends Zend_Layout_Controller_Action_Helper_Layout
如果您没有在自己的帮助程序中覆盖默认的disableLayout()函数,则仍然可以使用该函数

尝试使用以下方法进行测试:

class Application_Controller_Helper_Layout extends Zend_Layout_Controller_Action_Helper_Layout
{
    public function preDispatch(){}

    public function disableLayout(){
        echo "I won't disable layout anymore, because I overwrote the action with displaying this string.";
    }
}

非常感谢!我刚把名字从Layout改为Lay,现在一切都正常了!不客气。那也行。我不确定您是否希望继续使用该助手名称,因为正如我上面提到的,它将替换默认名称。因此,为了便于将来参考,请尽量避免使用与zend default helpers相同的名称,如果您不确定,在命名之前进行搜索是最快的方法。
class Application_Controller_Helper_Layout extends Zend_Layout_Controller_Action_Helper_Layout
{
    public function preDispatch(){}

    public function disableLayout(){
        echo "I won't disable layout anymore, because I overwrote the action with displaying this string.";
    }
}