在 Zend 视图助手中,有一个函数 url() 用于根据路由表输出 URL,例如
$this->url(array('controller' => 'comments', 'action' => 'add')
我怎样才能在控制器中做同样的事情?特别是我想使用控制器/动作语法而不是标准 URL 为 Zend 表单设置动作 URL,例如
$form = new Zend_Form;
$form->setMethod('post')->setAction( $this->url(array('controller' => 'comments', 'action' => 'add')) );