代码
namespace amsx\account;
class ActiveCodeProcessor{
private static $_processerPool = [];
/**
* @param $type
* @return ActiveCodeProcessor
*/
public static function getCodeProcessorObj($type){
if(!key_exists($type, self::$_processerPool)){
$className = 'ActiveCodeProcessor'.$type;
if(class_exists($className)){
self::$_processerPool[$type] = new $className;
}
}
}
}
方法
原来是使用了命名空间后,需要使用完整的带命名空间的类名,不会因为是当前类定义而简化。
echo class_exists('\think\Cache');