当前位置: 代码迷 >> .NET Framework >> Zendframework 模块化设立
  详细解决方案

Zendframework 模块化设立

热度:297   发布时间:2016-05-02 00:07:12.0
Zendframework 模块化设置

单模块布局目录:
application/
??? configs/
??? controllers/
??? models/
??? views/
??? Bootstrap.php

单模块布局的application.ini配置:
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"

Bootstrap:
??? protected function _initAutoload()
??? {
??????? $moduleLoader = new Zend_Application_Module_Autoloader(array(
??????????? 'namespace' => '',?
??????????? 'basePath' => APPLICATION_PATH));
??????? return $moduleLoader;
????????
??? }

多模块布局目录:
application/
??? Bootstrap.php
??? configs/
??? modules/
??????? default/
??????????? controllers/
??????????? models/
??????????? views/
??????? admin/
??????????? controllers/
??????????? models/
??????????? views/

?

?

多模块布局的application.ini配置:
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules/"
resources.frontController.moduleControllerDirectoryName = "controllers"
resources.frontController.defaultModule = "default"


Bootstrap:
??? protected function _initAutoload()
??? {
??????? $default_autoloader = new Zend_Application_Module_Autoloader(array(
??????????? 'namespace' => 'Default',
??????????? 'basePath' => APPLICATION_PATH . '/modules/default',
??????? ));

?? $admin_loader = new Zend_Application_Module_Autoloader(array(
????? 'namespace' => 'Admin',
????? 'basePath' => APPLICATION_PATH . '/modules/admin',
?? ));
??? }

转自:http://blog.sina.com.cn/s/blog_691b9e0d0100r1tg.html