以下代码创建了一个无限循环:
$app->OBJ = (object) array(
// SYSTEM OBJECTS
'SCOPE' => TRUE,
'URI' => TRUE,
'Log' => FALSE,
// APPLICATION OBJECTS
'User' => TRUE,
'Email' => TRUE,
'Files' => TRUE,
);
foreach ($app->OBJ as $obj => $bool) {
if($bool){
if(!class_exists($obj)) exit('Internal Error: Class \''.$obj.'\' not found.');
${strtoupper($obj)} = new $obj();
}
}
但如果我评论这一行,循环就会停止:
// ${strtoupper($obj)} = new $obj();
我的所有类文件都已加载,为什么class_exists
会创建无限循环?