Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何使用Codeigniter使网站国际化_Php_Codeigniter_Internationalization_Translation - Fatal编程技术网

Php 如何使用Codeigniter使网站国际化

Php 如何使用Codeigniter使网站国际化,php,codeigniter,internationalization,translation,Php,Codeigniter,Internationalization,Translation,如何用不同的语言翻译我的codeigniter网站 我实际上使用的是codeigniter的语言类。在应用程序/language/language\u文件夹/file\u lang.php中创建语言文件后,如何从一种语言切换到另一种语言 我用意大利语和英语创建了一种文件语言,但是我怎么知道从一种语言切换到另一种语言呢 当用户设置语言时,我可以在uri中使用函数吗?语言文件总是使用filename参数加载,但也使用language参数加载 如果在构造函数中写入此项: $CI =& get_

如何用不同的语言翻译我的codeigniter网站

我实际上使用的是codeigniter的语言类。在
应用程序/language/language\u文件夹/file\u lang.php
中创建语言文件后,如何从一种语言切换到另一种语言

我用意大利语和英语创建了一种文件语言,但是我怎么知道从一种语言切换到另一种语言呢


当用户设置语言时,我可以在uri中使用函数吗?

语言文件总是使用filename参数加载,但也使用language参数加载

如果在构造函数中写入此项:

$CI =& get_instance();
$CI->load->library('session'); (unless you autoload it)
$CI->language = $CI->session->userdata('lang') ? $CI->session->userdata('lang') : $CI->config->item('default_language');
if($CI->input->get('lang')) 
{
    $CI->session->set_userdata('lang', $CI->input->get('lang'));
} 
$CI->lang->load('file', $CI->session->userdata('lang'));
然后,只需在url中添加?lang=文件夹,即可切换语言