在bootstrap和application.ini中的Zend自动加载配置

时间:2011-08-25 15:33:08

标签: zend-framework autoload zend-application zend-app-bootstrap

假设:

1。
自举:

$autoloader = Zend_Loader_Autoloader::getInstance();// Zend_Loader_Autoloader
$autoloader->registerNamespace('Ntk_');

等于

application.ini:
autoloaderNamespaces [] =“Ntk _”


2。
自举:

$pluginLoader = $this->getPluginLoader();// Zend_Loader_PluginLoader     
$pluginLoader->addPrefixPath('My_Resource', APPLICATION_PATH . "/appResourcePlugins");

等于

application.ini:
pluginPaths.My_Resource = APPLICATION_PATH“/ appResourcePlugins”


3。
自举:

$moduleAutoloader = $this>getResourceLoader();//Zend_Application_Module_Autoloader      
$moduleAutoloader->addResourceType('need', 'needs', 'Needs');

等于

application.ini:
???



什么是用于配置Zend_Application_Module_Autoloader的application.ini方法?
(......如果存在的话)
我使用zend framework version 1.11.10

1 个答案:

答案 0 :(得分:-1)

也许这个例子可以帮到你:

    <?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{

protected function _initApplication()
{
$this->bootstrap('frontcontroller');
$front = $this->getResource('frontcontroller');
$front->addModuleDirectory(dirname(__FILE__) . '/modules');
}

protected function _initDoctype()
{
$this->bootstrap('view');
$view = $this->getResource('view');
$view->doctype('XHTML1_STRICT');
}
}

这是application.ini

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

resources.layout.layout = "layout"
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"
resources.view[] =

[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1 

参考:someone had the same question and got his answer here