强制自动加载没有名称的类 [英] Force autoloading of a class without having the name
问题描述
我想访问当前正在执行的脚本上下文中的所有类.不幸的是,我使用的框架在使用自动加载方面过于激进,并且故意推迟沿执行路径加载类.
I'd like to have access to all classes that are in the context of my currently executing script. Unfortunately, the framework I am using is aggressive with its use of autoloading, and purposely defers loading of classes along the execution path.
如何在不知道类名称的情况下强制所有具有注册 _autoload()
函数的类加载,以便我可以使用 get_declared_classes
,或者得到他们的名字?
How can I, without knowing the names of classes, force all classes that have a registered _autoload()
function to either load, so that I can access them with get_declared_classes
, or get their names?
推荐答案
好吧,如果自动加载功能被添加到 spl_autoload_register()
你应该看看 spl_autoload_functions()
.
Well, if the autoload functions were added to spl_autoload_register()
you should look at spl_autoload_functions()
.
或者,您可以使用 <强制调用所有已注册的自动加载器代码>spl_autoload_call().
Alternatively you could force the invocation of all registered autoloaders with spl_autoload_call()
.
这篇关于强制自动加载没有名称的类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!