note 113841 added to function.autoload
| From: | ohcc at 163 dot com | Date: | Sat, 07 Dec 2013 18:28:18 +0000 |
| Subject: | note 113841 added to function.autoload | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-197831@lists.php.net to get a copy of this message | ||
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($classFile)) include $classFile;
}
}
spl_autoload_register('classAutoLoader');
?>
----
Server IP: 72.52.91.14
Probable Submitter: 72.52.91.14
----
Manual Page -- http://php.net/manual/en/function.autoload.php
Edit -- https://master.php.net/note/edit/113841
Del: integrated -- https://master.php.net/note/delete/113841/integrated
Del: useless -- https://master.php.net/note/delete/113841/useless
Del: bad code -- https://master.php.net/note/delete/113841/bad+code
Del: spam -- https://master.php.net/note/delete/113841/spam
Del: non-english -- https://master.php.net/note/delete/113841/non-english
Del: in docs -- https://master.php.net/note/delete/113841/in+docs
Del: other reasons-- https://master.php.net/note/delete/113841
Reject -- https://master.php.net/note/reject/113841
Search -- https://master.php.net/manage/user-notes.php