我会知道PHP 7.3.3-1 + 0〜20190307202245.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);
}
}