note 100996 added to function.spl-autoload-register
| From: | schkovich+phpnet at gmail dot com | Date: | Fri, 19 Nov 2010 11:15:15 +0000 |
| Subject: | note 100996 added to function.spl-autoload-register | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-174178@lists.php.net to get a copy of this message | ||
@Anonymous:
http://www.php.net/manual/en/function.spl-autoload-register.php#96804)
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.
// {{{ 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;
----
Server IP: 69.147.83.197
Probable Submitter: 89.216.16.236
----
Manual Page -- http://www.php.net/manual/en/function.spl-autoload-register.php
Edit -- https://master.php.net/note/edit/100996
Del: integrated -- https://master.php.net/note/delete/100996/integrated
Del: useless -- https://master.php.net/note/delete/100996/useless
Del: bad code -- https://master.php.net/note/delete/100996/bad+code
Del: spam -- https://master.php.net/note/delete/100996/spam
Del: non-english -- https://master.php.net/note/delete/100996/non-english
Del: in docs -- https://master.php.net/note/delete/100996/in+docs
Del: other reasons-- https://master.php.net/note/delete/100996
Reject -- https://master.php.net/note/reject/100996
Search -- https://master.php.net/manage/user-notes.php