我有关于i18n-codeigniter集成的问题。我今天整合了i18n我的上一个项目。我在i18n之前有一些自定义路线。现在我根据i18n路线样式改变了它们。但我对第3段有一些问题。 我的意思是,我有这条路线:
$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时,会给我一个空白页...
我该如何解决这个问题? 谢谢大家
答案 0 :(得分: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文档:
路线将按照定义的顺序运行。更高的路线将 总是优先于较低的。
答案 1 :(得分: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';