* An example of a project-specific implementation. * * After registering this autoload function with SPL, the following line * would cause the function to attempt to load the FooBarBazQux class * from /path/to/project/src/Baz/Qux.php: * * new FooBarBazQux; * * @param string $class The fully-qualified class name. * @return void */ spl_autoload_register(function($class){
// initialize the namespace prefix array if (isset($this->prefixesMap[$prefix]) === false) { $this->prefixesMap[$prefix] = array(); }
// retain the base directory for the namespace prefix if ($prepend) { array_unshift($this->prefixesMap[$prefix], $base_dir); } else { array_push($this->prefixesMap[$prefix], $base_dir); }
近期评论