OSCLASS:self :: $ instance = new self;

时间:2015-03-18 17:42:00

标签: php

我已将osclass设置在我网站的目录中。当我尝试访问此目录(index.php)时,它返回响应状态为200的空白页面。我在apache错误日志中看不到任何错误。我也包含了这些行,并且没有报告任何错误。

error_reporting(E_ALL); 
ini_set('display_errors', 1);

当我试图检查php代码时,我发现行self :: $ instance = new self;未在此功能中执行:

    public static function newInstance()
    {
        if(!self::$instance instanceof self) {
            self::$instance = new self;  //It appears theres a problem with this line
        }
        return self::$instance;
    }

这是在Rewrite课程中。这个函数从oc-load.php调用:

$ instance被声明为private static:private static $ instance;

if( OC_ADMIN ) {
  ....
  ....
} else {
  // init Rewrite class only if it's the frontend   
  Rewrite::newInstance()->init();   
}

我刚开始使用oop php。据我所知,上面一行是试图创建一个新的Rewrite类实例。但是我无法找到为什么它没有被执行。

你能告诉我为什么会失败吗?

0 个答案:

没有答案