为什么zendframework的_forward方法能用而_redirect方法却不能用?
$this->_redirect('/login/success');
就会产生这样的错误:
Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (error)' in
而我改为:
$this->_forward("success","Login");就能够运行。
奇怪的是,我在地址栏中输入“http://localhost/mrzf/public/Login/success”是可以显示页面的,我的根目录是mrzf。
但是我在IndexController中的一个Action中,写入此条语句$this->_redirect('/Login/success');
就会出现'Invalid controller specified (error)'
补充说明一下,我的首页是一个登录框,用POST传递,先指向IndexController中的loginAction,然后在里面用$this->_redirect转向LoginController的successAction
我在:c:\AppServ\www\mrzf\application\views\scripts\index文件夹建一个login.phtml文件,随便写点代码。
然后把IndexController中的loginAction方法中的代码$this->_redirect('/Login/success');注释掉,添加$this->view->assign('title','zend framework框架测试成功!');
然后往浏览器的地址栏输入http://localhost/mrzf/public/index/login,是可以找到控制器和Action的,能够显示页面
但如果改回来,$this->_redirect('/Login/success');就会出错,'Invalid controller specified (error)',不知为什么?
相关推荐
ThinkPHP框架使用redirect实现页面重定向的方法实例分析
本文实例讲述了ThinkPHP框架使用redirect实现页面重定向的方法。分享给大家供大家参考,具体如下: ThinkPHP redirect 方法 ThinkPHP redirect 方法可以实现页面的重定向(跳转)功能。redirect 方法语法如下: $this->redirect(string url, array params, int delay, string msg) 参数说明: 参数 说明 url 必须,重定向的 URL 表达式。 params 可选,其它URL参数。 delay 可选, 重定向延时,单位为秒。 msg 可选,重定向提示信息。 T
zend framework重定向方法小结
本文总结了zend framework重定向的方法。分享给大家供大家参考,具体如下: 一. render 不指定render 结果: {当前Module}/{当前Controller}/{当前Action}.phtml $this->render('bar'); 结果: {当前Module}/{当前Controller}/bar.phtml 二. forward $this->_forward('bar'); 结果: {当前Module}/{当前Controller}/bar $this->_forward('bar', 'foo'); 结果: {当前Module}/foo/bar
Zend Framework动作助手Redirector用法实例详解
本文实例讲述了Zend Framework动作助手Redirector用法。分享给大家供大家参考,具体如下: Redirector 提供另一种实现方式,帮助程序重定向到内部或者外部页面; 转向器(Redirector)助手让你使用一个转向器对象帮助程序重定向到新的URL。与_redirect()方法相比,它具有多项优势。例如能够在转向器对象中预先配置整个站点的行为,或者使用与Zend_Controller_Action::_forward()相似的gotoSimple($action, $controller, $module, $params)接口。 转向器拥有影响重定向行为的大量方法: s
thinkPHP框架实现类似java过滤器的简单方法示例
主要介绍了thinkPHP框架实现类似java过滤器的简单方法,结合实例形式分析了thinkPHP基于继承实现的登录验证功能相关操作方法,需要的朋友可以参考下
mongodb-linux-x86_64-ubuntu2004-8.0.13.tgz
mongodb-linux-x86_64-ubuntu2004-8.0.13


Framework
