0

I'm guessing this line registers the autoload function, which in turn loads needed Zend classes.

Zend_Loader::registerAutoload();

My question: is this line meant to be used in applications that call some zend components but aren't fully zend applications? or is needed also in applications that are fully zend and use zend MVC?

4

1 回答 1

2

好吧,首先我们应该注意到它Zend_Loader::registerAutload()已被弃用(从 1.8.0 开始)。更好的是:

Zend_Loader_Autoload::getInstance();

这样做是注册一个 SPL__autoload($classname)函数,该函数在调用类但尚未加载时尝试加载类。这个自动加载器在非框架应用程序中的默认行为是将一个类名映射到一个文件名(相对于当前定义的include_path)和include()该文件,希望在那里定义所请求的类。

特定映射使用PEAR 1-class-1-file 约定,其中名为 like 的类My_ComponentName_ClassName将驻留在文件中My/ComponentName/ClassName.php

有关更多详细信息,请参阅此答案

于 2010-10-02T12:24:07.513 回答