【问题标题】:PHP "Helper Class" - Class not foundPHP“助手类” - 找不到类
【发布时间】:2012-02-15 18:07:18
【问题描述】:

我遇到了一个问题,即从 PHP 5.3.2 到 5.3.3 的代码不再能找到“I2A2”类。

这里有一些信息:

错误: ErrorException [错误]:找不到类“I2A2”

致命错误:在第 6 行的 /var/www/html/root/sandbox/lpolicin/t6/fuel/app/classes/observer/selectcustomer.php 中找不到类“I2A2”

$directory_listing = \I2A2::get_customer_info("puid",$customer->puid);

代码:

"classes/observer/selectcustomer.php"

class Observer_Selectcustomer extends Orm\Observer 
{

    public function after_load(Model_Customer $customer)
    {
        $directory_listing = \I2A2::get_customer_info("puid",$customer->puid);
    }
}

“类/I2A2.php”

class I2A2 
{
    if (static::$initalized === true)
    {
        return;
    }
}

自动加载器(这是插入一个巨大的数组,然后自动加载每一个)....

{
    'always_load'   => array(
     'classes'  => array(),
}

如果您需要更多信息,请告诉我!

【问题讨论】:

  • 您不再加载该类。此外,从您发布的代码片段中,它没有显示类的定义与您的类加载器之间的任何关系。

标签: php class fuelphp autoloader


【解决方案1】:

检查你的路径:第一个是完全小写的,但第二个突然有文件名大写。无论类名如何,Fuel 中的所有路径都是完全小写的。因此,将 I2A2 类的文件名更改为 i2a2.php 即可。

【讨论】:

  • 这就是问题所在,从mac切换到真正的unix,应该已经意识到所有文件路径等都应该是小写的!
猜你喜欢
  • 2013-09-02
  • 2015-05-30
  • 2013-07-31
  • 2016-02-19
  • 2018-09-29
  • 2011-09-27
  • 1970-01-01
  • 1970-01-01
  • 2012-06-02
相关资源
最近更新 更多