note 113847 deleted from function.autoload by peehaa
| From: | peehaa@php.net | Date: | Mon, 09 Dec 2013 11:40:16 +0000 |
| Subject: | note 113847 deleted from function.autoload by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-197843@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
It is highly recommended not to use the __autoload() function any more. Now the
spl_autoload_register() function is what you should consider.Sorry for the mistake in line 6 of my
previous note. And below is the corrected PHP code.
<?php
if(!function_exists('classAutoLoader')){
function classAutoLoader($class){
$class=strtolower($class);
$classFile=$_SERVER['DOCUMENT_ROOT'].'/include/class/'.$class.'.class.php';
if(is_file($classFile)&&!class_exists($class)) include $classFile;
}
}
spl_autoload_register('classAutoLoader');
?>