New Zend_Loader_Autoloader does not find files

I just upgraded from ZF 1.7 to ZF 1.9, and almost everything works fine ... except for Autoloader.

Old:

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

New:

require_once 'Zend/Loader/Autoloader.php';  
$loader = Zend_Loader_Autoloader::getInstance();  
$loader->registerNamespace('MySiteName_');
$loader->setFallbackAutoloader(true);

The files that I need for automatic loading are mostly not related to names (because this is a big project from pre-namespacing). They are in the following directories:

  • / application / controllers
  • / general / models
  • /library
  • / supplier

, , , , /library/Form.php
, . , require_once/Form.php, , , , . , "setFallbackAutoloader (true)", "" , , .

:
.:/Users/lofye//HTDOCS/mysitename/
:/Users/lofye//HTDOCS/mysitename/
:/Users/lofye//HTDOCS/mysitename//
:/Users/lofye//HTDOCS/mysitename/
:/Users/lofye//HTDOCS/mysitename

!

+3
3

, , :

require_once 'library/Form.php';

, , , :

require_once 'Form.php';

require_once 'Form.php'; script. ? /library, .

0

, MySiteName_. Form , ?

$loader->registerNamespace('Form');
+1

The class name inside the file library/Form.phpshould be Form. What is the name of your class?

I tested here and it works great.

0
source

Source: https://habr.com/ru/post/1725127/


All Articles