Zend Routes 翻译 URL [英] Zend Routes translate URL's
本文介绍了Zend Routes 翻译 URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
1) 我有一个控制器日历",并且有通过 url 获取日期的操作showDate".因此,网址类似于日历/显示日期/日期/2012-07-22"
1) I have a controller "calendar" and have action "showDate" which gets date via url. So, url is something like "calendar/show-date/date/2012-07-22"
2) 我有一个显示所有条目的链接,日历/"
2) I have a link to display all entries, "calendar/"
所以,我想创建路由,让我的链接看起来像kalendar/2012-07-22"和kalendar/".
So, I want to create routes so my links look like "kalendar/2012-07-22" and "kalendar/".
有人可以帮我吗?
推荐答案
根据这篇文章:http://www.zf.fr/forum/viewtopic.php?id=5138
解决方案是将 '@locale' => $lang 添加到参数中.
The solution is to add '@locale' => $lang to the params.
$this->url(array('lang'=>'it','@locale'=>'it'))
它对我来说效果很好.
这篇关于Zend Routes 翻译 URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文