note 113848 deleted from function.autoload by crell
| From: | crell@php.net | Date: | Mon, 04 Apr 2022 16:25:18 +0000 |
| Subject: | note 113848 deleted from function.autoload by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218045@lists.php.net to get a copy of this message | ||
Note Submitter: ohcc at 163 dot com
----
It is highly recommended not to use the __autoload() function any more. Now the
spl_autoload_register() function is what you should consider.
<?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');
?>