CodeIgniter:“无法加载请求的类” [英] CodeIgniter: "Unable to load the requested class"
问题描述
在我的WAMP盒子上,我执行了以下操作:
- 添加了一个名为/application/libraries/Foo.php
- Foo.php是一个类,它的名称是
Foo
- autoload.php,我添加了
$ autoload ['libraries'] = array('foo');
一切正常。当我上传到我的LAMP盒子,我得到以下错误:
无法加载请求的类:foo
/application/libraries/Foo.php的权限为0755.所有者与其他CI文件相同。从自动加载中取出 foo
可以使问题消失。
任何想法可能出错?
在Windows中,路径中的大小写并不重要。在Linux中。
当您自动载入时,请使用「Foo」而不是「foo」。
。
我认为它可以工作,当你把它从自动加载,因为codeigniter足够聪明,以找出路径中的大小写和类在php。 p>
On my WAMP box, I did the following:
- Added a file called /application/libraries/Foo.php
- Foo.php is a class, and it's name is
Foo
- In /application/config/autoload.php, I added
$autoload['libraries'] = array('foo');
Everything works fine. When I upload to my LAMP box, I get the following error:
Unable to load the requested class: foo
Permission of /application/libraries/Foo.php is 0755. Owner is the same as the rest of the CI files. Taking foo
out from autoload makes the problem go away.
Any ideas what might be wrong?
In Windows, capitalization in paths doesn't matter. In Linux it does.
When you autoload, use "Foo" not "foo".
I believe that will do the trick.
I think it works when you take it out of autoloading because codeigniter is smart enough to figure out the capitalization in the path and classes are case independent in php.
这篇关于CodeIgniter:“无法加载请求的类”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!