🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
路径:/module/Application/config/module.config.php 内容如下: ~~~ return array( 'router' => array( 'routes' => array( 'application' => array( 'type' => 'segment', 'options' => array( 'route' => '/[application][:controller][/:action]', 'constraints' => array( 'controller' => '[a-zA-Z][a-zA-Z0-9_-]*', 'action' => '[a-zA-Z0-9_-]*', ), 'defaults' => array( '__NAMESPACE__' => 'Application\Controller', 'controller' => 'Index', 'action' => 'index' ), ), ), ), ), 'controllers' => array( 'invokables' => array( 'Application\Controller\Index' => 'Application\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/layout/layout.phtml', 'application/index/index' => __DIR__ . '/../view/application/index/index.phtml', 'error/404' => __DIR__ . '/../view/error/404.phtml', 'error/index' => __DIR__ . '/../view/error/index.phtml', ), 'template_path_stack' => array( 'application' => __DIR__ . '/../view' ), ), 'service_manager' => array( 'factories' => array( 'translator' => 'Zend\I18n\Translator\TranslatorServiceFactory', 'navigation' => 'Zend\Navigation\Service\DefaultNavigationFactory', ), ), 'translator' => array( 'locale' => 'en_US', 'translation_file_patterns' => array( array( 'type' => 'gettext', 'base_dir' => __DIR__ . '/../language', 'pattern' => '%s.mo', ), ), ), 'navigation' => array( 'default' => array( array( 'label' => 'Home', 'route' => 'applicaton’ ), array( 'label' => 'Application', 'route' => 'application’, 'pages' => array( array( 'label' => 'List', 'route' => 'application’, 'action' => 'list', ), ), ), ), ), ); ~~~ 先对以上配置进行归类: ~~~ array(// 总配置 ‘router’ =>array(),// 路由 ‘controllers’ =>array(),// 控制器 ‘view_manager’ =>array(),// 视图管理器 ‘service_manager’ =>array(),// 服务器管理器 ‘translator’ =>array(),// 译码器或翻译器 ‘navigation’ =>array(),// 页面导航 ); ~~~ 下面对 router、controllers、view_manager、service_manager、translator 、navigation进行逐个解释。