<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                ## 使用`thinkTemplate`模板引擎 新版框架默認只能支持PHP原生模板,如果需要使用`thinkTemplate`模板引擎,需要安裝`think-view`擴展(該擴展會自動安裝`think-template`依賴庫)。 ~~~ composer require topthink/think-view ~~~ thinkTemplate是基于XML和標簽庫的編譯型模板引擎 ~~~php <?php namespace think; require __DIR__.'/vendor/autoload.php'; // 設置模板引擎參數 $config = [ 'view_path' => './template/', 'cache_path' => './runtime/', 'view_suffix' => 'html', ]; $template = new Template($config); // 模板變量賦值 $template->assign(['name' => 'think']); // 讀取模板文件渲染輸出 $template->fetch('index'); // 完整模板文件渲染 $template->fetch('./template/test.php'); // 渲染內容輸出 $template->display($content); ~~~ 支持靜態調用 ~~~ use think\facade\Template; Template::config([ 'view_path' => './template/', 'cache_path' => './runtime/', 'view_suffix' => 'html', ]); Template::assign(['name' => 'think']); Template::fetch('index',['name' => 'think']); Template::display($content,['name' => 'think']); ~~~ ### **配置文件** tp中使用thinkTemplate模板引擎則需要在安裝完成后,在配置目錄的`view.php`文件中進行模板引擎相關參數的配置,例如: ~~~ return [ // 模板引擎類型 'type' => 'Think', // 模板路徑 'view_path' => './template/', // 模板后綴 'view_suffix' => 'html', // 模板文件名分隔符 'view_depr' => '/', // 模板引擎普通標簽開始標記 'tpl_begin' => '{', // 模板引擎普通標簽結束標記 'tpl_end' => '}', // 標簽庫標簽開始標記 'taglib_begin' => '{', // 標簽庫標簽結束標記 'taglib_end' => '}', ]; ~~~ >[danger]最原始的配置在vendor\topthink\think-template\src\Template.php: ### 調用`engine`方法初始化 視圖類也提供了`engine`方法對模板解析引擎進行初始化或者切換不同的模板引擎,例如: ~~~ <?php namespace app\index\controller; use think\facade\View; class Index { public function index() { // 使用內置PHP模板引擎渲染模板輸出 return View::engine('php')->fetch(); } } ~~~ 表示當前視圖的模板文件使用原生php進行解析。 > 如果你需要動態改變模板引擎的參數,請使用視圖類提供的`config`方法進行動態設置,而不要使用改變配置類參數的方式。 ~~~ <?php namespace app\index\controller; use think\facade\View; class Index { public function index() { // 改變當前操作的模板路徑 View::config(['view_path' => 'mypath']); return View::fetch(); } } ~~~ 關于模板引擎的標簽用法,可以[參考這里](http://www.hmoore.net/manual/think-template/content)。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看