Zend Framework - 重定向到路由方向 [英] Zend Framework - Redirect to routed direction

查看:39
本文介绍了Zend Framework - 重定向到路由方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 PHP Zend 框架时遇到了一个小问题.我在文件 application.ini 中有以下路由:

I have a small problem with PHP Zend Framework. I have the following routes in file application.ini:

resources.router.routes.mainpage.route = "main-page.html"
resources.router.routes.mainpage.defaults.controller = "index"
resources.router.routes.mainpage.defaults.acion = "index"

如果我直接执行任何操作:

If i do a direct in any action:

$this->_helper->redirector('index', 'index');

然后我将被重定向到地址:my-project/public/index/index但我想成为一个my-project/public/main-page.html(因为它是确定的application.ini)

then i will be redirect to adress: my-project/public/index/index But i want to adress be a my-project/public/main-page.html (as it is determined application.ini)

有人可以帮我吗?附言对不起我的英语.

Can somebody help me? P.S. Sorry for my english.

推荐答案

使用来自 重定向助手

$this->_redirector = $this->_helper->getHelper('Redirector');
$this->_redirector->gotoRoute(
        array('fooRouteArgument' => fooValue),
        'route-name'
);

对于您的情况,此结果为:

For your case this result in:

$this->_redirector->gotoRoute(array(), 'mainpage');

这篇关于Zend Framework - 重定向到路由方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆