English 中文(简体)
使用多种语言,有路。 php
原标题:Using multiple languages with routes.php

随着我对我的申请增加多语言支持,我与我的路线有问题。 某些路线已经停工的营地。

似乎有一个部分奏效,任何部分都有两个或两个以上。

关于如何确定这一点的任何帮助都会受到高度赞赏。

路线。 php 摘录:

// URI like  /en/about  -> use controller  about 
$route[ ^(en|br)/(.+)$ ] = "$2";
$route[ dashboard ] =  dashboard ;    //THIS WORKS
$route[ profile ] =  profile/profile_list ;
$route[ profile_list/page ] =  profile/profile_list ;    //THIS DOESN T
$route[ profile_list/page/(:any) ] =  profile/profile_list/$1 ;
$route[ profile/update ] =  profile/update ;
$route[ profile/(:any) ] =  profile/$1 ;
$route[ default_controller ] =  landing ;
//  /en ,  /de ,  /fr  and  /nl  URIs -> use default controller
$route[ ^(en|br)$ ] = $route[ default_controller ]; 
问题回答

以下列信息列出了对这一问题的答案:Codeigniter Forum

仅需要增加这一变量,其中包括任何两部文字语言代码的午餐部分。

$prepended_lang = "(?:[a-zA-Z]{2}/)?"; 

之后相应修改路线:

$route[$prepended_lang. logout ] =  login/logout ;




相关问题
URL rewrite in IIS6 - Third party tools

I have collected the following api/sdk/whatever which provide modules for doing url rewriting in IIS 5/6/7. Some are free-open source and some require $. I haven t tried any of them. I would like to ...

Rewrite spring-security redirect URLs

I m trying to get Tuckey UrlRewriteFilter to tidy up URLs for my webapp. One problem I ve got is that when spring-security notices that an anonymous user is trying to access a protected resource it ...

ASP.NET Friendly URLs

In my research, I found 2 ways to do them. Both required modifications to the Application_BeginRequest procedure in the Global.Asax, where you would run your code to do the actual URL mapping (mine ...

Could I get by HttpModule the URL that contains * before?

My web-site is working under ASP.NET 3.5, IIS7, Integrated pipiline mode. My HttpModule is getting request to all resources, including URLs like this: http://my-site.com/address And I would support *...

Domains & Foreward Slash

This is rather difficult to explain so please bear with me. We will be hosting 4 websites on our server and the plan is to have each site sit under its own domain: site-a.com site-b.com sub1.site-b....

URL Mod-Rewrite

I currently have a working URL: http://example.com/security-services.php?service=fixed-camera-surveillance and then I have PHP say, $_REQUEST[ service ] to do some stuff... But I d like to ...

热门标签