Home  >  Article  >  Backend Development  >  thinkphp中使用模版布局,如何把一个数据对象传到主模版当中?

thinkphp中使用模版布局,如何把一个数据对象传到主模版当中?

WBOY
WBOYOriginal
2016-06-06 20:16:181251browse

开启了模版布局,我只能把一个数据对象assign到继承该模板布局的子内容页面当中。

回复内容:

开启了模版布局,我只能把一个数据对象assign到继承该模板布局的子内容页面当中。

模版加载解析时,子模版和主模版会合并成一个模版,assign 是对合并后的模版进行数据绑定的。

子模版的为什么会到主模板去?

我问题描述不够清除。现在可以了,我直接在主模板中嵌入php代码,没有在控制器中写。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn