Home > Backend Development > PHP Tutorial > thinkphp中在Controller的函数调用?

thinkphp中在Controller的函数调用?

WBOY
Release: 2016-06-20 12:39:00
Original
2504 people have browsed it

如果thinkphp中有控制器IndexController,那么其中的index函数中加有如下代码
this->display(), 它的页面显示会调用index.html吗?
也就是说,页面显示时,所调用的模板名与函数中相同?


回复讨论(解决方案)

是的,在默认情况下,所调用的模板名与函数名中相同

好像是这样的 比如INDEX控制器 的模板要在模板目录下建一个和控制器一样名字(比如INDEX)的文件夹下面创建一个模板

this->display() 默认的就是调用的模板名与函数中相同 要调用其他的就this->display(文件名) 

$this->display()默认所调用的模版名和函数名相同,如果你想在此函数里调用其它的模版,可以这样写$this->display(“模版名”)

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template