在 zend 框架中使用正确的路由重新渲染页面
学习使用 zend 框架,我面临一些小问题。 我使用 Zend_Form 创建一个登录表单,然后在我的控制器中调用我的控制器中的表单
这是我的模块的布局
Module: compte
控制器:compteController
操作:loginAction
在我的 application.ini 中,我为登录路由创建一个资源,如下所示:
resources.router.routes.login.route = /compte/login
resources.router.routes.login.defaults.module = compte
resources.router.routes.login.defaults.controller = compte
resources.router.routes.login.defaults.action = login
然后我像这样调用登录页面 example.com/compte/login 问题是在验证表单时,如果是登录页面再次显示错误,该错误是正确的,但总路径为 example.com/compte/compte/login。
我的问题是,如何纠正这个问题,以便当表单无效时,表单在资源管理器中重新显示正确的地址。
预先感谢您的回答
learing to work with zend framework, I am facing some minor problem.
I create a login form with Zend_Form, and then in my Controller I call my form in my controller
Here is the layout of my module
Module: compte
controller: compteController
Action: loginAction
In my application.ini I create a resource for my login route like this:
resources.router.routes.login.route = /compte/login
resources.router.routes.login.defaults.module = compte
resources.router.routes.login.defaults.controller = compte
resources.router.routes.login.defaults.action = login
I then call the login page like this exemple.com/compte/login the problem is that when validating the form, if the is an error the login page display again which is correct but with the total route exemple.com/compte/compte/login.
My question is that how can I correct this problem so that when the form is not valid the form re-display with correct address in the explorer.
Thanks in advance for your answer
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
表单的操作设置是什么?
也许您需要在视图或控制器中执行
$form->setAction('/compte/login');
。What is the form's action set to?
Maybe you need to do
$form->setAction('/compte/login');
in the view or controller.你可以这样做:
you could do somthing like: