<?php
namespace app\index\controller;
use think\Controller;
class App extends Controller
{
public function index()
{
//视图渲染①
return $this->fetch('yemian/txl');
//视图渲染②
return $this->fetch('../application/index/view/index/index.html');
}
}
视图渲染①
表示模板文件(省略后缀)是位于与控制器App同模块下的view下的yemian文件夹下的txl.html。
'index/index')
视图渲染②(此方式是对于模板文件位置比较特殊的或者需要自定义模板文件的位置)
表示模板文件(不可省略后缀)是位于application目录下的index模块下的view文件夹下的yemian文件夹下的txl.html。
'../application/index/view/yemian/txl.html' // thinkphp5.1中../默认定位到了项目根目录WWW下