Php 在布局中显示视图而不在AiryMVC框架的视图中包含其他文件?

Php 在布局中显示视图而不在AiryMVC框架的视图中包含其他文件?,php,Php,如果视图包含页眉和页脚,则每个视图都需要同时包含页眉和页脚才能正确显示 例如,我所有的观点都是正确的 include header.php <div class="main"> ... put the view here </div> include footer.php include header.php ... 把风景放在这里 包含footer.php 我们是否可以在AiryMVC中定义布局或模板,使每个视图不包含页眉和页脚,但仍在页面中显示页眉和页脚

如果视图包含页眉和页脚,则每个视图都需要同时包含页眉和页脚才能正确显示

例如,我所有的观点都是正确的

include header.php

<div class="main">
   ... put the view here
</div>

include footer.php
include header.php
... 把风景放在这里
包含footer.php

我们是否可以在AiryMVC中定义布局或模板,使每个视图不包含页眉和页脚,但仍在页面中显示页眉和页脚?

您应该在控制器中定义包含视图的布局。然后,不用

$this->view->render();
你需要使用

$this->layout->render();
在控制器中