我从https://github.com/zendframework/ZendSkeletonApplication下载了 Skeleton ,它工作正常。一切对我来说都很清楚。
但是当我添加另一个模块时会发生什么?我从骨架中复制模块,更改名称,然后将新模块添加到 application.config.php:
return array(
'modules' => array(
'Application',
'Api',
),
[...]
并更改 module.config.php 中的路由:
return array(
'router' => array(
'routes' => array(
'api' => array(
'type' => 'Literal',
'options' => array(
'route' => 'api/',
'defaults' => array(
'__NAMESPACE__' => 'Api\Controller',
'controller' => 'Api',
'action' => 'api',
),
),
'may_terminate' => true,
'child_routes' => array(
'default' => array(
'type' => 'Segment',
'options' => array(
'route' => '/api[/:action]]',
'constraints' => array(
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array(
),
),
),
),
),
),
),
'service_manager' => array(
'factories' => array(
'translator' => 'Zend\I18n\Translator\TranslatorServiceFactory',
),
),
'translator' => array(
'locale' => 'en_US',
'translation_file_patterns' => array(
array(
'type' => 'gettext',
'base_dir' => __DIR__ . '/../language',
'pattern' => '%s.mo',
),
),
),
'controllers' => array(
'invokables' => array(
'Application\Controller\Index' => 'Application\Controller\IndexController',
'Application\Controller\Auth' => 'Application\Controller\AuthController'
),
),
'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(
__DIR__ . '/../view',
),
),
);
但现在我看到了来自 api 的布局,甚至是来自骨架的位置。怎么做?