Php 致命错误:未捕获逻辑异常:未找到函数自动加载

Php 致命错误:未捕获逻辑异常:未找到函数自动加载,php,Php,我知道PHP7.3.3-1+0~2019030720245.32+stretch~1.gbp32ebb2中是否有一些特殊的东西 因为我在安装软件时遇到了这个错误 :autoload' not found (class 'Core\\OM\\CORE' not found) Got error 'PHP message: PHP Fatal error: Uncaught LogicException: Function 'Core\\OM\\CORE::autoload' not fou

我知道PHP7.3.3-1+0~2019030720245.32+stretch~1.gbp32ebb2中是否有一些特殊的东西 因为我在安装软件时遇到了这个错误

:autoload' not found (class 'Core\\OM\\CORE' not found)



Got error 'PHP message: PHP Fatal error:  Uncaught LogicException: Function 'Core\\OM\\CORE::autoload' not found (class 'Core\\OM\\CORE' not found) in /var/www/.........../application.php:21\nStack trace:\n#0 /var/www/........./application.php(21): spl_autoload_register('Core\\\\OM...')\n#1 /var/www/clients/........./install/index.php(12): require('/var/www/client...')\n#2 {main}\n  thrown in /var/www/........../install/includes/application.php on line 21'
在linux下的本地主机上,我没有这个问题,一切正常。 php:php版本7.3.2-3

多谢各位

例如,在install.php目录中:

 use Core\OM\CORE;
 use Core\OM\HTML;

// set the level of error reporting
      error_reporting(E_ALL & ~E_DEPRECATED);

      define('CORE_BASE_DIR', realpath(__DIR__ . '/../../includes/') . '/Core/');

      require(CORE_BASE_DIR . 'OM/CORE.php');
      spl_autoload_register('Core\OM\CORE::autoload')
关于CORE.PHP

public static function autoload($class)  {
  $prefix = 'Core\\';

  if (strncmp($prefix, $class, strlen($prefix)) !== 0) {
    return false;
  }

  if (strncmp($prefix . 'OM\Module\\', $class, strlen($prefix . 'OM\Module\\')) === 0) { // TODO remove and fix namespace
    $file = dirname(CORE_BASE_DIR) . '/' . str_replace(['Core\OM\\', '\\'], ['', '/'], $class) . '.php';
    $custom = dirname(CORE_BASE_DIR) . '/' . str_replace(['Core\OM\\', '\\'], ['Core\Custom\OM\\', '/'], $class) . '.php';
  } else {
    $file = dirname(CORE_BASE_DIR) . '/' . str_replace('\\', '/', $class) . '.php';
    $custom = str_replace('Core/OM/', 'Core/Custom/OM/', $file);
  }

  if (is_file($custom)) {
    require($custom);
  } elseif (is_file($file)) {
    require($file);
  }
}

为什么你有时使用转义\有时不使用?@Dharman:你能解释一下这句话吗?这是一个意外的例外。捕获它并检查异常对象以查看问题所在。@miken32当执行此命令时,spl\u autoload\u register('Core\OM\Core::autoload')会显示http 500,并在日志中描述上述错误。我的问题是:路径文件在验证后是正常的。未读取CORE.php。通常在查找函数具有名称空间的类型为
callable
的参数时,我们会执行类似于
spl_autoload_register(['\\CORE\\OM\\CORE',autoload'])的操作为什么有时使用转义\有时不使用?@Dharman:你能解释一下这句话吗?这是一个未捕获的例外。捕获它并检查异常对象以查看问题所在。@miken32当执行此命令时,spl\u autoload\u register('Core\OM\Core::autoload')会显示http 500,并在日志中描述上述错误。我的问题是:路径文件在验证后是正常的。未读取CORE.php。通常在查找函数具有名称空间的类型为
callable
的参数时,我们会执行类似于
spl_autoload_register(['\\CORE\\OM\\CORE',autoload'])的操作