我的网站抛出“PHP 致命错误:调用未定义的方法 CI_Lang::lang()”
我使用 CodeIgniter Framework 2.1.0 创建了一个网站,最初运行良好。昨天,我将此 i18n 代码集成到网站中以获得多语言支持。 现在,当我将网站上传到 cpanel 并打开它时,我的日志文件中出现以下错误:
[2011 年 11 月 21 日 10:19:04] PHP 致命错误:调用 XXXX 中未定义的方法 CI_Lang::lang()
但是,该网站在我的本地主机服务器(Windows 的 xampp)上运行良好。怎么了?
I created a website using CodeIgniter Framework 2.1.0 that was originally working well. Yesterday, I integrated this i18n code into the site for multi-language support.
Now, when I upload my site to cpanel and open it, I get this error in my log file:
[21-Nov-2011 10:19:04] PHP Fatal error: Call to undefined method CI_Lang::lang() in XXXX
However, the website is working well on my localhost server (xampp for Windows). What's wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
请参阅附加到库的线程: http://web.archive.org/web/20120112092127/http://codeigniter.com/forums/viewthread/179036。在第一篇文章中附加了一个修改后的库,声称可以减轻原始库的错误。
第一页上还有一篇文章引用了与您类似的错误:
虽然他似乎在调用 CI_Lang,而不是 Lang。他的解决方案似乎是使用论坛线程中附加的代码。
另外,cpanel 是一个托管控制面板,而不是托管提供商。但是您的托管提供商可能会引起问题(例如,如果使用旧版本的 PHP,它不能与新版本的 CI 一起使用。托管提供商通常会让您能够选择正在使用的 PHP 版本 - 通常在 cPanel 中找到) 。
See the thread attached to the library: http://web.archive.org/web/20120112092127/http://codeigniter.com/forums/viewthread/179036. In the first post is attached a modified library that claims to alleviate the buggyness of the original.
There is also a post on the first page there referencing an error similar to yours:
Though he seems to be calling CI_Lang, not Lang. His solution appears to have been to use the code attached to the forum thread.
Also, cpanel is a control panel for hosting, not a hosting provider. But your hosting provider may be causing issues (e.g. if using older versions of PHP which do not work with newer version of CI. Often hosting providers will give you the ability to choose which version of PHP you are using--usually found in cPanel).
您是否已将所有新文件上传到您的实时服务器?该错误意味着该代码未找到或可供脚本使用。
have you uploaded ALL the new files to your live server? that error implies that the code is not found or available to the script.
我遇到了同样的问题....它在本地主机上工作正常,但是当加载到实时服务器上时,它给了我未定义的错误...出现问题是因为我在实时服务器上创建了名为 My_Lang.php 和 My_Config.php 的文件它区分大小写......所以我将其更改为 MY_Config.php 和 MY_Lang.php ....现在工作正常......希望它也适合你
I came accross the same problem.... it was working fine on localhost but when loaded on live server it gives me undefined error... the problem appears becuase I created file with name My_Lang.php and My_Config.php as on live server it is case sensitive.... so I changed it to MY_Config.php and MY_Lang.php .... it works fine now.... Hope it will work for you too