我正在使用以下代码段从多个文件夹中自动加载类:
// Check if the autoload configuration file exists
if(is_file("configuration/autoload")) {
// Extract the listed folders from the configuration file
$folders = explode("\n", file_get_contents("configuration/autoload"));
// Prepend the base path to the extracted folder paths
array_unshift($folders, get_include_path());
// Configure the folders in which to attempt class autoloading
set_include_path(implode(PATH_SEPARATOR, $folders));
// Configure the file extensions that should be autoloaded
spl_autoload_extensions(".php");
// Administer the attempt to autoload classes
spl_autoload_register();
}
几个文件夹列在一个文件中,如下所示:
core/utility
core/factory
core/modules
core/classes
core/classes/form
core/classes/form/fields
frontend
它在本地像魅力一样工作,但我无法让它在我的在线服务器上工作(我做了 CHMOD 所有涉及的文件和文件夹)。我想在设置包含路径时出了点问题,但我似乎无法理解它。
有任何想法吗?
谢谢