Codeigniter DB语言扩展不工作


Codeigniter DB Language extension not working

我正在尝试使用这个扩展

但是它在加载库时给了我以下错误:

Unable to load the requested class: Language

同样,如果我写MY_Language,它会给我以下错误:

Fatal error: Class 'CI_Language' not found in C:'wamp'www'ckphp'application'libraries'MY_Language.php on line 79

我正在使用WAMP和CI v. 2.2.0

谢谢!

我自己在做了一些研究后发现了这个问题。

显然,语言类甚至不在库文件夹中,而是在核心文件夹中,这意味着它应该放在核心应用程序/核心文件夹中。此外,文件名不是CI_Language,而是CI_Lang,这意味着文件名必须是MY_Lang(如果MY_是您的前缀)。扩展名中最后要更改的是

parent::CI_Language();

parent::__construct();

和一切应该工作正常!

用法:

$this->lang->load('set', 'language'); // To load a language
$this->lang->line('key'); // to display the text

lang('key'); // if using the language helper

希望这将有助于别人在未来!

我为最新的CodeIgniter 3.1制作了一个GIST。X包括与迁移创建数据库结构

https://gist.github.com/cyberfly/885b320fdf914ae15f7316b22cc72f32