# View 通过加载器加载并返回一个模板 ## loader ``` /** * html测试 */ public function http_html_test() { $template = $this->loader->view('server::404'); $this->http_output->end(template); } ``` server::404 是指Server/Views下的404.blade.php文件 app::404 是指app/Views下的404.blade.php文件 具体的请参考blade模板引擎。 ## 修改模板引擎 SD支持自定义模板引擎。 可以通过重写AppServer中的setTemplateEngine方法设置自定义的模板引擎,以下是设置Plates模板引擎的代码。 ```php /** * 设置模板引擎 */ public function setTemplateEngine() { $this->templateEngine = new Engine(); $this->templateEngine->addFolder('server', __DIR__ . '/Views'); $this->templateEngine->addFolder('app', __DIR__ . '/../app/Views'); $this->templateEngine->registerFunction('get_www', 'get_www'); } ``` 再通过自定义Loader实现自定义的view加载即可。 [Blade教程](http://laravelacademy.org/post/8773.html)