自定义模块的配置说明

来源:互联网 发布:mac win7 共享文件夹 编辑:程序博客网 时间:2024/06/05 10:38

上一篇已经介绍了创建新模块的目录结构,下面就对config中的module.config.php配置文件进行介绍:

<?php/** * @todo 配置该模块的基本属性及MVC布局 *///配置文件return array(    'router' => array(        'routes' => array(            'home' => array(                'type' => 'Zend\Mvc\Router\Http\Literal',                'options' => array(                    'route'    => '/',                    'defaults' => array(                        'controller' => 'home\Controller\Index',                        'action'     => 'index',                    ),                ),            ),            'application' => array(                'type'    => 'Literal',                'options' => array(                    'route'    => '/home',                    'defaults' => array(                        '__NAMESPACE__' => 'home\Controller',                        'controller'    => 'Index',                        'action'        => 'index',                    ),                ),                'may_terminate' => true,                'child_routes' => array(                    'default' => array(                        'type'    => 'Segment',                        'options' => array(                            'route'    => '/[:controller[/:action]]',                            'constraints' => array(                                'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',                                'action'     => '[a-zA-Z][a-zA-Z0-9_-]*',                            ),                            'defaults' => array(                            ),                        ),                    ),                ),            ),        ),    ),    'service_manager' => array(        'abstract_factories' => array(            'Zend\Cache\Service\StorageCacheAbstractServiceFactory',            'Zend\Log\LoggerAbstractServiceFactory',        ),        'aliases' => array(            'translator' => 'MvcTranslator',        ),    ),    'translator' => array(        'locale' => 'zh_CN',        'translation_file_patterns' => array(            array(                'type'     => 'gettext',                'base_dir' => __DIR__ . '/../language',                'pattern'  => '%s.mo',            ),        ),    ),    'controllers' => array(        'invokables' => array(            'home\Controller\Index' => 'home\Controller\IndexController'        ),    ),    'view_manager' => array(        'display_not_found_reason' => true,        'display_exceptions'       => true,        'doctype'                  => 'HTML5',        'not_found_template'       => 'error/404',        'exception_template'       => 'error/index',        'template_map' => array(            'layout/layout'           => __DIR__ . '/../view/home/layout/layout.phtml',            'home/index/index' => __DIR__ . '/../view/home/index/index.phtml',            'home/index/home'  => __DIR__ . '/../view/home/index/home.phtml',            'error/404'               => __DIR__ . '/../view/home/error/404.phtml',            'error/index'             => __DIR__ . '/../view/home/error/index.phtml',        ),        'template_path_stack' => array(             'home' => __DIR__ . '/../view',        ),    ),        'console' => array(        'router' => array(            'routes' => array(                            ),        ),    ),);

上面是鄙人配置时使用的配置文件内容大家可以自己看下。

0 0
原创粉丝点击