我在第一個檔案裡面使用autoload()引入其他檔案,在第二個檔案開始也使用了該方法。然後我在3個檔案裡面對2個類進行執行個體化。 err:Cannot redeclare __autoload() (previously declared in C:\AppServ\www\test\autoload_test.php:1) in C:\AppServ\www\test\include1.php on line 4
簡潔代碼:
檔案1:
function __autoload($class_name){
include $class_name.".php";
}
class include1{}
?>
檔案2:
function __autoload($class_name){
include $class_name.".php";
}
class include2{}
?>
檔案3:
include $class_name.".php";
}
$inculde1=new include1();
$inculde2=new include2();
?>
請指教.