// +---------------------------------------------------------------------- namespace app\controller; use app\BaseController; use think\facade\View; class Base extends BaseController { use \liliuwei\think\Jump; // 使用内置PHP模板引擎渲染模板输出 protected $tpl_config = [ 'view_dir_name' => 'public' . DIRECTORY_SEPARATOR . 'template', 'tpl_replace_string' => [ '__static__' => '/static', '__img__' => '/static/front/images', '__css__' => '/static/front/css', '__js__' => '/static/front/js', '__public__' => '/static/front', ], ]; public $data = []; //渲染数据 protected function fetch($template = '') { View::config($this->tpl_config); View::assign($this->data); View::fetch($template); } }