如果布局文件夹在模块目录之外,我们如何在 zf2 中设置默认布局

您可以在任何您想要的地方设置布局,而不必在模块目录中。
只需将其设置在您的模块配置中
'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' => '/anypath/you/want/view/layout/layout.phtml',
),
'template_path_stack' => array(
'/anypath/you/want/view',
),
),
根据发布的问题,@Andrew 的答案是正确的。
当我注意到 zf2 中布局的工作时,我得出了一定的结论
例如
'modules' => array(
'Album',
'Testlist',
'Customer',
'Application',
'User',
),
然后将采用用户布局。
如果我们在应用程序中只有一个布局,这很好
在模块中的布局之间切换遇到了 http://www.webtrafficexchange.com/zf2-configure-layout-each-module-edpmodulelayouts 这似乎很有用
默认布局layout/layout在视图管理器中配置。