ThinkPHP 控制器-方法中,通过
$this->display();
来输出带有模板的视图。
那么就从这个方法入手。
1.Action.class.php 控制器基类
这是控制器基类,在这里面找到display()方法。
protected function display($templateFile='',$charset='',$contentType='',$content='',$prefix='') {
$this->view->display($templateFile,$charset,$contentType,$content,$prefix);
}
可以看出,这里实际上是调用 View视图类的display()方法。
2.View.class.php 视图类
public function display($templateFile='',$charset='',$contentType='',$content='',$prefix='') {
...
// 解析并获取模板内容
$content = $this->fetch($tem