Model view controller 无法向控制器zend framework提交表单
我在视图项目中创建了一个静态的HTML文件,它位于模块访问中。 我希望控制器在提交表单时处理请求Model view controller 无法向控制器zend framework提交表单,model-view-controller,zend-framework,Model View Controller,Zend Framework,我在视图项目中创建了一个静态的HTML文件,它位于模块访问中。 我希望控制器在提交表单时处理请求 <form action="addVisit" method="post"> <input type="text" name="number"/> <input type="submit" name="save"/> http://localhost/zendApps/InspectionSys/public/visits/visits/Visi
<form action="addVisit" method="post">
<input type="text" name="number"/>
<input type="submit" name="save"/>
http://localhost/zendApps/InspectionSys/public/visits/visits/VisitsController/addVisit
在控制器中有一个功能动作
public function addVisitAction()
{
echo 'here';
}
我该怎么办?首先,您可能会重新考虑将操作大小写为camel,因为如果这样做,您必须处理视图文件名,如
add visit.phtml
,我认为这也会影响URL,我发现只需将操作名保留为小写的addVisitAction()
,这可能是问题的一部分。接下来,将表单操作标识为
/module/controller/action
(如果您不使用模块,可以省略该参数),因此您的操作至少应该是/visions/vists/addvisit
或/visions/vists/add visit
(不太确定哪个操作会正常工作)。另外,当使用非Zend_表单生成的html表单时,您可以使用
$this->getParams()
或$this->getParam('paramName')
而不是$this->getValues()
访问值。您的上一个问题发生了什么?你没定好路线吗?