How does zend Framework automatically load classes

  • 2020-06-22 23:56:28
  • OfStack

1. Automatic loading of classes in modules

$loader = new Zend_Application_Module_Autoloader(array(   // Module content automatically loads classes 
    'namespace' => 'Blog',// Namespace definition   The method begins with Blog_
    'basePath'  => APPLICATION_PATH . '/modules/blog',// Module position 
));

2. Automatic loading

require_once 'Zend/Loader/Autoloader.php';
$loader =Zend_Loader_Autoloader::getInstance();
$loader->registerNamespace('Application_');
// Note that the loaded directory address has been loaded 


Related articles: