0

我对 i18n-codeigniter 集成有疑问。我今天集成了 i18n 我的最后一个项目。在 i18n 之前我有一些自定义路线。现在我根据 i18n 路线风格改变了它们。但我对第三段有一些问题。我的意思是,我有这样的路线:

$route['default_controller'] = "welcome";
$route['404_override'] = '';

$route['^(tr|en)/hakkimizda'] = 'Bilgi/Hakkimizda';
$route['^(tr|en)/kampanyalar'] = 'Bilgi/Kampanyalar';
$route['^(tr|en)/haberler'] = 'Haberler';
$route['^(tr|en)/kampanyalar/(.+)$'] = 'Bilgi/Kampanyalar/$1';
$route['^(tr|en)/haberler/(:any)'] = 'Haberler/HaberDetay/$1';
$route['^(tr|en)/urunler'] = 'Urunler';
$route['^(tr|en)/urunler/(:any)'] = 'Urunler/Detay/$1';
$route['^(tr|en)/urunler/kategori/(:any)'] = 'Urunler/Kategori/$2';
$route['^(tr|en)/kesif-talebi'] = "Iletisim/Kesif_Talebi";
$route['^(tr|en)/iletisim'] = "Iletisim";
$route['^tr$'] = $route['default_controller'];
$route['^en'] = $route['default_controller'];

一些链接运行良好。当我进入http://webadress.com/en/urunler时,它运行良好,但是当我输入http://webadress.com/en/urunler/kategori/parameter时,它给了我空白页。 ..

我该如何解决这个问题?谢谢你们

4

2 回答 2

2

您的(任何:)路线优先。

尝试切换顺序:

$route['^(tr|en)/urunler/(:any)'] = 'Urunler/Detay/$1';
$route['^(tr|en)/urunler/kategori/(:any)'] = 'Urunler/Kategori/$2';

$route['^(tr|en)/urunler/kategori/(:any)'] = 'Urunler/Kategori/$2';
$route['^(tr|en)/urunler/(:any)'] = 'Urunler/Detay/$1';

来自 CI 文档:

路由将按照它们定义的顺序运行。较高的路线总是优先于较低的路线。

http://codeigniter.com/user_guide/general/routing.html

于 2012-09-12T23:32:18.497 回答
1

交换这两行应该没问题

$route['^(tr|en)/urunler/(:any)'] = 'Urunler/Detay/$1';
$route['^(tr|en)/urunler/kategori/(:any)'] = 'Urunler/Kategori/$2';

$route['^(tr|en)/urunler/kategori/(:any)'] = 'Urunler/Kategori/$2';
$route['^(tr|en)/urunler/(:any)'] = 'Urunler/Detay/$1';
于 2012-09-12T23:32:41.637 回答