note 100996 deleted from function.spl-autoload-register by danbrown

From: Date: Fri, 19 Nov 2010 14:23:34 +0000
Subject: note 100996 deleted from function.spl-autoload-register by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-174194@lists.php.net to get a copy of this message
Note Submitter: schkovich+phpnet at gmail dot com ---- Note that if no parameter is provided, then the default implementation of spl_autoload() will be registered and that by default it checks all include paths to contain filenames built up by the lowercase class name appended by the filename extensions .inc and .php. If such implementation does not suit your needs you can define and register autoload function that meets your needs. <?php // {{{ constants /** * Holds the path to the source files */ define('BASE_PATH', dirname(__FILE__) . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR); // }}} /** * Define and register autoloader function */ if (false === \spl_autoload_register(function ($className) { require \BASE_PATH . str_replace( "\\", \DIRECTORY_SEPARATOR, $className ) . ".php"; })) : throw new Exception("Unable to register autoload function.", 248); endif; ?>

« previous php.notes (#174194) next »