💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# 包含文件 包含模板 连接模板 我们之前的介绍都是在控制器中 单独输出了一个模板文件. 但我们的项目肯定是需要使用到 包含文件的 最常见的就是 HTML的 header 以及footer 或Menu ## 使用实例 **Index**控制器内容 ~~~ <?php namespace Action; use HY\Action; class Index extends Action { public function Index(){ $this->display("index"); } } ~~~ 模板 **index.html** 内容 ~~~ {include header} 我是Index模板<br> {include footer} ~~~ 模板 **header.html** 内容 ~~~ 我是头部文件 header <br> ~~~ 模板 **footer.html** 内容 ~~~ 我是尾部文件 footer <br> ~~~ +++ / <<< Success 我是头部文件 header 我是Index模板 我是尾部文件 footer +++ ## {include 模板名} 可见我们的结果中. 控制器输出了index模板 而index中使用了include 包含了header 以及 footer 使用 {include} 是不需要加入模板后缀的.