[英]i18n with parameters
I have integrated in my project Internationalization (i18n) library, and I have some problems with Ist an second segments. 我已将其集成到项目国际化(i18n)库中,第二段存在一些问题。 I have routes:
我有路线:
$route['^(en|ru)/services'] = 'services';
$route['^(en|ru)/services/(:any)/(:any)'] = 'services/showcat/$1/$2';
$route['^(en|ru)/services/(:any)'] = 'services/showcat/$1';
some links work perfectly lake site.pc/en/services
bat when I enter site.pc/en/services/private_service
or site.pc/en/services/private_service/idart
I can't get params what I ned, it given to me that 当我输入
site.pc/en/services/private_service
或site.pc/en/services/private_service/idart
时,某些链接可以在site.pc/en/services
bat上正常工作我无法得到我想要的参数,它给了我那个
public function showcat($idCat, $idart = '') {
echo ' id: ' . $idCat; // en
//and for http://site.pc/en/services/private_service/3
echo ' idart: ' . $idServise; // empty
}
Why I can't get idCat = private_service and idart = 3 为什么我无法获得idCat = private_service和idart = 3
if I add in array controller services to not localized 如果我将阵列控制器服务添加到未本地化
// special URIs (not localized) var $special = array ( "dashboard", "settings", "services" ); //特殊URI(未本地化)var $ special = array(“ dashboard”,“ settings”,“ services”); in class MY_Lang then i get good parameters get idCat = private_service and idart = 3
在类MY_Lang中,然后我得到了很好的参数:idCat = private_service和idart = 3
To get my parameters I need to ad in routes 3rd params 要获取我的参数,我需要在路线3rd参数中投放广告
$route['^(en|ru)/services/(:any)/(:any)/(:any)'] = 'services/showcat/$1/$2/$3';
and in function 和功能
//url is site.pc/en/services/private_service/3/anyvars
function showcat($idCat, $idart = '', $k = '') {
//idCat is en
//idart is private_service
//k is 3
}
Why firs parameter is get lang 为什么firs参数为lang
SOLVED! 解决了!
It seems first ID in rout is one of this (en|ru) so in my routes line it has to be that 似乎rout中的第一个ID是其中的一个(en | ru),因此在我的路线行中必须是
$route['^(en|ru)/services/(:any)/(:any)/(:any)'] = 'services/showcat/$2/$3/$4';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.