Zend_View_Helper_ * ve autoloading ile yardımcısı Okuma

1 Cevap php

Ben böyle Fallback Autoloader kullanmak üzere autoloader belirledik:

$autoloader=Zend_Loader_Autoloader::getInstance();
$autoloader->setFallbackAutoloader(true);

Php hataları bakarsanız, bir uyarı örneğin de bir yardımcı okumaya çalışırken bir Zend_View_Helper her çağrı için oluşturulur: /var/www/arc/views/helpers/. İşte bir örnek uyarıdır:

    fopen(/var/www/arc/views/helpers/Layout.php) [<a href='function.fopen'>function.fopen</a>]:
 failed to open stream: No such file or directory in file /private/var/www/arc/ZendFramework-
1.9.5/library/Zend/Loader.php at line: 165

Sorun burada gibi görünüyor:

["_prefixToPaths:protected"] => array(1) {
  ["Zend_View_Helper_"] => array(2) {
    [0] => string(17) "Zend/View/Helper/"
    [1] => string(34) "/var/www/arc/views/helpers/"
  }

Bunun için FallbackAutoloader neden kullanıyor mu? Bu potansiyel bir performans sorunu olacak gibi görünüyor. Ayrıca, doğru ad Zend_View_Helper_ çözmek gerekir? Ben burada ne eksik?

Update: no, Zend/View/Helper/Layout.php is there.

Belki, Zend_Loader_Autoloader (I docs bu durumda biraz zayıf olduğunu düşünüyorum) yapıyor olması gerekiyordu ne noktayı kaçırıyorum.

Örneğin, ben şu benim application.ini dosyayı ayarlayın eğer:

[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
includePaths.models= APPLICATION_PATH "/models"
includePaths.helper= APPLICATION_PATH "/controllers/helpers"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"

ve çıkış include_path, modelleri, dizin ekleme yolu açıkça ama sınıf yüklenmiyor.

Ben sonra Bootstrap _init işlevi aşağıdaki eklerseniz

 $autoloader=Zend_Loader_Autoloader::getInstance();
 $autoloader->setFallbackAutoloader(true);

Bu güzel yükler. Eski durum için, ben bir ad alanı ayarlamak gerekiyor?

to first comment: here are current values with output:

Zend_Debug::dump($loader->isFallbackAutoloader(),'is fallback autoloader');
is fallback autoloader bool(false)

Zend_Debug::dump($loader->getDefaultAutoloader(),'default autoloader');
default autoloader array(2) {
  [0] => &string(11) "Zend_Loader"
  [1] => string(9) "loadClass"
}

Zend_Debug::dump($loader->getAutoloaders(),'autoloaders');
autoloaders array(0) {
}

1 Cevap

Başka autoloaders var mı? Değilse, (true) setFallbackAutoloader gerekmez.

Oluyor korkak bir şey kesinlikle var. Zend / Görünüm / Yardımcı / Layout.php şekilde silinmiş mi?