note 84233 added to language.oop5.autoload

From: Date: Fri, 04 Jul 2008 13:21:35 +0000
Subject: note 84233 added to language.oop5.autoload
Groups: php.notes 
Request: Send a blank email to php-notes+get-141167@lists.php.net to get a copy of this message
I'm very taken with the autoload function, and thought I would share with you my implementation of it: <?php function __autoload($class_name) { //my settings class is a singleton instance that has parsed an ini file containing the locations of all classes $settings = Settings::Load(); $classes = $settings->getSettings('classes'); $path = $classes[$class_name]; if(file_exists($path)) { require_once($path); return true; } else { clearstatcache(); $classes = $settings->ReLoadSettings(); $path = $classes['classes'][$class_name]; } if(file_exists($path)) { require_once($path); return true; } else { die("The requested library,".$class_name.", could not be found at ".$classes[$class_name][$i].". Please check your ini file"); } } ?> ---- Server IP: 208.69.120.35 Probable Submitter: 81.96.134.125 ---- Manual Page -- http://www.php.net/manual/en/language.oop5.autoload.php Edit -- https://master.php.net/note/edit/84233 Del: integrated -- https://master.php.net/note/delete/84233/integrated Del: useless -- https://master.php.net/note/delete/84233/useless Del: bad code -- https://master.php.net/note/delete/84233/bad+code Del: spam -- https://master.php.net/note/delete/84233/spam Del: non-english -- https://master.php.net/note/delete/84233/non-english Del: in docs -- https://master.php.net/note/delete/84233/in+docs Del: other reasons-- https://master.php.net/note/delete/84233 Reject -- https://master.php.net/note/reject/84233 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#141167) next »