🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
engine(string $type = null):View -- 获取模板引擎 ``` \think\Facade\View::engine('php')->fetch(); ``` assign($name, $value = null):View -- 模板变量赋值 filter(callable $filter = null):View -- 视图过滤 fetch(string $template = '', array $vars = []): string -- 解析和获取模板内容 用于输出 display(string $content, array $vars = []): string -- 渲染内容输出 __set($name, $value):view -- 模板变量赋值 __get($name):mixed -- 取得模板显示变量的值 __isset($name):bool -- 检测模板变量是否设置 getDefaultDriver():string|null -- 默认驱动 **父类Manager:** __call($method, $parameters):mixed -- 当调用不存在的方法时就会调用指定的模板引擎(默认是php原生模板引擎)里的方法 >[danger]php原生模板引擎。位置:vendor\topthink\framework\src\think\view\driver\Php.php 如果你需要使用tp5`think-template`模板引擎,需要安装`think-view`模板引擎驱动。 ~~~ //他会自动把think-template模板引擎也一并下载下来 composer require topthink/think-view ~~~ 模板引擎驱动有哪些方法 exists(string $template): bool -- 检测是否存在模板文件 fetch(string $template, array $data = []): void -- 渲染模板文件 display(string $content, array $data = []): void -- 渲染模板内容 config(array $config): void -- 配置模板引擎 getConfig(string $name):void -- 获取模板引擎配置 __call($method, $params)