我们正在使用 Zend 路由器,它似乎覆盖了表单发送的参数。到达控制器的唯一参数是来自 Url 的参数。
有谁知道为什么会这样?
这是配置文件:
; Routing config
routes.groups.route = groups/:group/:type/:idPost/:postUrl/:page
routes.groups.defaults.controller = groups
routes.groups.defaults.action = index
routes.groups.defaults.type = main
routes.groups.defaults.idPost =
routes.groups.defaults.postUrl =
routes.groups.defaults.page = 1
和形式:
<form action="<?= $this->_view->baseUrl ?>/groups/<?= $group['groupUrl'] ?>/deletepost/" method="post">
<input type="hidden" name="formUrl" value="<?=$formUrl ?> />
...
</form>
控制器:
public function deletepostAction() {
$params = $this->getRequest()->getParams();
print_r($params);
die;
}
...输出:
Array
(
[group] => dandy-handwriting
[type] => deletepost
[idPost] =>
[controller] => groups
[action] => index
[postUrl] =>
[idGroup] => 1
[lang] => en
)
请注意,缺少“formUrl”,它只是来自路由器的参数。