/ Published in: PHP
http://us.php.net/manual/en/language.oop5.autoload.php#82614
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php function __autoload($class_name) { //class directories 'classes/', 'classes/otherclasses/', 'classes2/', 'module1/classes/' ); //for each directory foreach($directorys as $directory) { //see if the file exsists { require_once($directory.$class_name . '.php'); //only require the class once, so quit after to save effort (if you got more, then name them something else return; } } } ?>
URL: http://us3.php.net/__autoload