Destramic Posted April 19, 2011 Share Posted April 19, 2011 hey guys im having a problem with my class it sees the constructor isnt loading and this line isnt executed spl_autoload_register(array($this, 'load_class')); i dont see why not if anyone can help please <?php class Autoloader { private static $_declared_classes = array(); private static $_ignore_files = array(); public function __construct() { spl_autoload_register(array($this, 'load_class')); } public static function load_class($class_name) { $class_name = ucwords($class_name); $file = self::get_class_path($class_name); try { if (!class_exists($class_name, FALSE)) { if (file_exists($file)) { require_once $file; self::$_declared_classes[] = $class_name; } else { throw new Exception(sprintf("Class '%s' not found.<br />\n", $class_name)); } } } catch (Exception $e) { echo $e->getMessage(); } } private static function get_class_path($class_name) { global $classes; if (array_key_exists($class_name, $classes)) { return ROOT . DS . $classes[$class_name]; } } public static function declared_classes() { echo "<pre>"; print_r(self::$_declared_classes); echo "</pre>"; } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.