<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>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # 視圖 ## 視圖 視圖是存儲基于系統的表示邏輯的好方法,例如API或端點使用的標記,或與CMS和后端區域共享的標記。[郵件服務](https://octobercms.com/docs/services/mail)還使用視圖來提供默認模板內容。視圖通常存儲在`views`插件目錄中。 一個簡單的視圖可能看起來像這樣: ~~~ <!-- View stored in plugins/acme/blog/views/greeting.htm --> <html> <body> <h1>Hello, {{ name }}</h1> </body> </html> ~~~ 也可以使用`.php`擴展名,使用PHP模板來解析視圖: ~~~ <!-- View stored in plugins/acme/blog/views/greeting.php --> <html> <body> <h1>Hello, <?php echo $name; ?></h1> </body> </html> ~~~ 可以使用以下`View::make`方法將該視圖返回到瀏覽器: ~~~ return View::make('acme.blog::greeting', ['name' => 'Charlie']); ~~~ 第一個參數是“路徑提示”,其中包含插件名稱,以兩個冒號分隔`::`,后跟視圖文件名。傳遞給第二個參數`View::make`是應該對視圖可用的數據數組。 > **注意**:路徑提示區分大小寫,插件名稱應始終小寫。 #### 將數據傳遞到視圖 ~~~ // Using conventional approach $view = View::make('acme.blog::greeting')->with('name', 'Steve'); // Using magic methods $view = View::make('acme.blog::greeting')->withName('steve'); ~~~ 在上面的示例中,變量`name`可以從視圖訪問,并且包含`Steve`。如上所述,如果要傳遞數據數組,可以將其作為方法的第二個參數`make`: ~~~ $view = View::make('acme.blog::greeting', $data); ~~~ 也可以在所有視圖之間共享一條數據: ~~~ View::share('name', 'Steve'); ~~~ #### 將子視圖傳遞到視圖 有時您可能希望將一個視圖傳遞到另一個視圖。例如,給定一個子視圖存儲在`plugins/acme/blog/views/child/view.php`,我們可以將其傳遞給另一個視圖,如下所示: ~~~ $view = View::make('acme.blog::greeting')->nest('child', 'acme.blog::child.view'); $view = View::make('acme.blog::greeting')->nest('child', 'acme.blog::child.view', $data); ~~~ 然后可以從父視圖呈現子視圖: ~~~ <html> <body> <h1>Hello!</h1> {{ child|raw }} </body> </html> ~~~ #### 確定是否存在視圖 如果需要檢查視圖是否存在,請使用以下`View::exists`方法: ~~~ if (View::exists('acme.blog::mail.customer')) { // } ~~~
                  <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>

                              哎呀哎呀视频在线观看