因此,我目前正在使用样板插件结构开发一个插件。当我尝试包含项目所需文件的文件夹时,会出现问题。我转到admin类,并使用以下代码包含此文件夹中的所有内容:
foreach(glob(\'folder/*.php\' ) as $file) {
include_once $file;
}
当我创建所包含的一个类的实例时,这会产生一个错误。如果不创建实例,则不会出现错误。尽管如此,如果我在文件顶部使用此代码,一切都会正常工作。
include_once(\'folder/class1.php\');
include_once(\'folder/class2.php\');
include_once(\'folder/class3.php\');
include_once(\'folder/class4.php\');
include_once(\'folder/class5.php\');