0

就像在主题中一样,我在视图助手中有两个静态方法但是当我尝试通过调用控制器动作时

Zend_View_Helper_SomeHelper::firstStaticMethod();

我收到错误:

Warning: include_once(Zend/View/Helper/SomeHelper.php): failed to open stream: No such file or directory in /library/Zend/Loader.php on line 134 Warning: include_once(): Failed opening 'Zend/View/Helper/SomeHelper.php' for inclusion (include_path='/application/../library:/library:.:/usr/share/pear:/usr/share/php') in /library/Zend/Loader.php on line 134 Fatal error: Class 'Zend_View_Helper_SomeHelper' not found in /application/modules/default/controllers/Controller.php on line 174

帮助代码:

class Zend_View_Helper_SomeHelper extends Zend_View_Helper_Abstract {
    //....//
    public static function firstStaticMethod(){
        //some code hear
    }
    public static function secoundStaticMethod(){
        //some code hear
    }
}

我需要在助手和操作中使用此方法。有任何想法吗?

4

1 回答 1

1

你能试试这个

$viewHelperObj = $this->view->getHelper('SomeHelper');
$viewHelperObj->secoundStaticMethod();
于 2013-11-21T04:47:03.243 回答