1

请帮我。我的情况是当我像这样在 url 上隐藏 index.php 和控制器名称时:

localhost/ctc/index.php/controllers/function/ ==> localhost/ctc/function

它工作正常,之后,我想在我的网站中使用多语言并使用该网站的教程:http: //maestric.com/doc/php/codeigniter_i18n,我的网址转到:

localhost/ctc/function ==> localhost/ctc/en/function 或 localhost/ctc/fr/function

问题是,当我将语言从法国更改为英语时,当前页面会变成英语(当然),但是当我点击其他页面时,语言又回到默认语言是法国,我不知道为什么。

这是我的 routes.php:

    $route['default_controller'] = "main/main_page";
    $route['en/main/(:any)'] = "main/$1";
    $route['fr/main/(:any)'] = "main/$1";
    $route['en/(:any)'] = "main/$1";
    $route['fr/(:any)'] = "main/$1";
    $route['(:any)'] = "main/$1";
    $route['^(en|fr)/(.+)$'] = "$1";
    $route['^(en|fr)$'] = $route['default_controller'];
    $route['404_override'] = '';
4

0 回答 0