<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智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ## 2.6 視圖類 ~~~ 1. 在控制器方法中使用視圖方法 2. 編寫核心文件2個視圖的方法 3. 創建視圖文件 4. 傳遞數據 ~~~ ### 1. 在控制器方法中使用視圖方法 * * * * * *D:\wamp\www\web.com\app\ctrl\indexCtrl.php* ~~~ <?php namespace app\ctrl; class indexCtrl extends \core\thinkphp { public function index() { $data = "Hello World!"; $this->assign('title', $data); $this->display('index/index.html'); } } ~~~ 備注:`class indexCtrl extends \core\thinkphp` 我們讓index控制器繼承框架核心文件,在核心文件中創建2個視圖的方法 ### 2. 編寫核心文件2個視圖的方法 * * * * * *D:\wamp\www\web.com\core\thinkphp.php* ~~~ public $assign; ...... // 傳遞數據 public function assign($name, $value) { $this->assign[$name] = $value; } // 顯示視圖 public function display($file) { $file = APP.'/view/'.$file; if (is_file($file)) { p($this->assign); extract($this->assign); include $file; } } ~~~ 備注:[extract()](http://php.net/manual/zh/function.extract.php) 從數組中將變量導入到當前的符號表 ### 3. 創建視圖文件 *D:\wamp\www\web.com\app\view\index\index.html* ~~~ <h1>這是標題</h1> <h3>段落內容段落內容段落內容段落內容段落內容</h3> ~~~ ### 4. 傳遞數據 *D:\wamp\www\web.com\app\ctrl\indexCtrl.php* ~~~ <?php namespace app\ctrl; class indexCtrl extends \core\thinkphp { public function index() { $data = "Hello World!"; $content = "這是一段內容!!!!!!!!!!!!!!!!!!!"; $this->assign('title', $data); $this->assign('content', $content); $this->display('index/index.html'); } } ~~~ 在視圖中顯示數據:`D:\wamp\www\web.com\app\view\index\index.html` ~~~ <h1><?php echo $title; ?></h1> <h3><?php echo $content; ?></h3> ~~~ **顯示效果:** ![](https://box.kancloud.cn/8b22131848e61be999e8d0b660079c84_742x498.png)
                  <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>

                              哎呀哎呀视频在线观看