CodeIgniter:“无法加载请求的类” [英] CodeIgniter: "Unable to load the requested class"

查看:150
本文介绍了CodeIgniter:“无法加载请求的类”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的WAMP盒子上,我执行了以下操作:


  1. 添加了一个名为/application/libraries/Foo.php

  2. Foo.php是一个类,它的名称是 Foo

  3. 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:

  1. Added a file called /application/libraries/Foo.php
  2. Foo.php is a class, and it's name is Foo
  3. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆