2

这是我的表单生成器功能:

private function getAddArtistForm() {
  $form = new Zend_Form();
  $form->setAction("saveArtist");
  $form->setMethod("post");
  $form->setName("addartist");
  ...
}
public function newAction()
{
  $form = $this->getAddArtistForm();
  $this->view->form = $form;

}

我还有一个名为saveArtistAction

public function saveArtistAction() {
...
}

但是当我提交表单时,我收到以下错误:

Message: Action "saveartist" does not exist and was not trapped in __call() 

请求参数:

array (
  'controller' => 'artist',
  'action' => 'saveartist',
  'module' => 'default',
)  
4

1 回答 1

7

如果你action用连字符指定怎么办:

'action' => 'save-artist',

?

于 2012-08-15T23:55:12.550 回答