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



给定:

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框架版本1.11.10

也许这个例子会对你有所帮助:

    <?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 

参考:有人有同样的问题,在这里得到了他的答案

相关内容

  • 没有找到相关文章

最新更新