我是 ZF2 的新手,在我的控制器中接收 post/get 参数时遇到问题。出现以下异常:
Zend\ServiceManager\Exception\ServiceNotFoundException
Zend\Mvc\Controller\PluginManager::get was unable to fetch or create an instance for fromPost
我的 index.phtml
...
<form id="formActionCl" action="/public/checklistCore/delete" method="post">
<input type="submit" id="butto_doAction<?php echo $index;?>" hidden="true" value="<?php echo $this->translate('button_confirm_action', 'checklist');?>"/>
<input type="hidden" id="checklist" value="<?php echo $index;?>">
</form>
...
和控制器:
use Zend\Mvc\Controller\Plugin\AbstractPluginManager,
...
public function deleteAction()
{
$cl_id = $this->fromPost('checklist');
echo $cl_id;
//$cl_id = $_GET['checklist'];
$checklist = $this->getEntityManager()->getRepository('ChecklistCore\Entity\Checklist')->find($cl_id);
$checklist->status = 'inactiv';
$this->getEntityManager()->persist($checklist);
$this->getEntityManager()->flush();
return $this->redirect()->toUrl('index');
}
我想我忘记了 module.config 中的某些内容,但我找不到任何东西,如何声明 serviceManager 正确(module.config.php)