关于goto------zf学习笔记(11/08/06 12:07)

前几天在项目中看到这句代码:

$this->getHelper('redirector')->goto('login', 'account');

找遍了rediretor.php 也找不到goto方法,最后发现原来是在__call中。goto原来就是gotoSimple,呵呵~~

public function __call($method, $args)
    {
        $method = strtolower($method);
        if ('goto' == $method) {
            return call_user_func_array(array($this, 'gotoSimple'), $args);
        }
        if ('setgoto' == $method) {
            return call_user_func_array(array($this, 'setGotoSimple'), $args);
        }
        if ('gotoandexit' == $method) {
            return call_user_func_array(array($this, 'gotoSimpleAndExit'), $args);
        }

        require_once 'Zend/Controller/Action/Exception.php';
        throw new Zend_Controller_Action_Exception(sprintf('Invalid method "%s" called on redirector', $method));
    }
posted @ 2011-08-06 12:14  越------  阅读(209)  评论(0)    收藏  举报