【发布时间】:2011-07-06 16:13:41
【问题描述】:
我如何用 php 创建所有插件的实例,该实例实现了插件接口,并保存在特定的插件目录中。
我在 C# 中做过类似的事情
Assembly assembly = Assembly.LoadFrom(pFileName);
foreach (Type type in assembly.GetTypes()){
if (type.IsPublic){
if (!type.IsAbstract){
Type typeInterface = type.GetInterface(pTypeInterface.ToString(), true);
if (typeInterface != null){
try{
object plugin = Activator.CreateInstance(pluginInterfaceType);
有没有办法在php中翻译这个?
实现这一点最简单、最安全的方法是什么?
问候
【问题讨论】:
标签: php class plugins interface