我有下面给出的钩子控制器类
<?php
class LanguageLoader
{
function initialize() {
$ci =& get_instance();
$ci->load->helper('language');
$site_lang = $ci->session->userdata('site_lang');
if ($site_lang) {
$ci->lang->load('main',$ci->session->userdata('site_lang'));
} else {
$ci->session->set_userdata('site_lang','english');
$ci->lang->load('main','english');
}
}
}
?>
这是语言切换器类
<?php
class languageSwitcher extends NQF_Controller {
public function __construct() {
parent::__construct();
$this -> load -> helper('url');
}
function switchLanguage($language = "", $url) {
$language = ($language != "") ? $language : "english";
$this -> session -> set_userdata('site_lang', $language);
redirect($url);
}
}
?>
我已将语言文字放在标题中
<?php echo $this->lang->line('contact_location'); ?>
在标题中,我得到了与加载语言相对应的相应文本。但是当我保持相同的lang-&gt;行(&#39; contact_location&#39;)时; ?&GT;在页脚中,我变得空白。为什么会这样?