zend framework 1.10アップグレードZend_を使用Loader_Autoloader

1982 ワード

元のもの:
 
require_once('Zend/Loader.php');
Zend_Loader::registerAutoload();

1.8以降:
require_once('Zend/Loader/Autoloader.php');
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->setFallbackAutoloader(true);

setFallbackAutoloaderに関する公式の説明
Finally, there may be times when you want the autoloader to load any namespace. For instance, PEAR libraries do not share a common namespace, making specifying individual namespaces difficult when many PEAR components are in use. You can use the setFallbackAutoloader() method to have the autoloader act as a catch-all:
自動ローダで任意のネーミングスペースをロードしたい場合があります.たとえば、PEARライブラリには共通のネーミングスペースがなく、多くのPEARのコンポーネントが異なるネーミングスペースを指定するのは難しい.setFallbackAutoloaderメソッドで自動ローダを自動的に認識できます.