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

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ### Response的實例化 - 再調用http的run方法,再進過路由的調度,最終再Dispath的run方法中進行Response的實例化。 ``` public function run() { .... $data = $this->exec(); return $this->autoResponse($data); } ``` - exec(); 方法其實是進行實例化控制器,并執行控制器操作方法,最終返回執行結果。再控制器方法中可以直接return 出結果,框架會自動構建出Response對象。 - 將結果 帶入autoResponse函數,該函數里面,可以看到Resconse對象的實例化。 ~~~ protected function autoResponse($data): Response { if ($data instanceof Response) { $response = $data; } elseif (!is_null($data)) { // 默認自動識別響應輸出類型 $type = $this->request->isJson() ? 'json' : 'html'; $response = Response::create($data, $type); } else { // 獲取緩沖數據,并清空緩沖 $data = ob_get_clean(); $content = false === $data ? '' : $data; $status = '' === $content && $this->request->isJson() ? 204 : 200; $response = Response::create($content, 'html', $status); } return $response; } ~~~ - 有以上代碼可以看出,再控制器方法中只需要return 出數據即可, 也可以return出Response對象。(若控制器方法return的數據是response實例,則直接返回,若控制器方法return的數據不是response對象,則通過autoResopnse方法,構造出一個response對象) - 由autoResponse函數可以看出,在控制器沒有返回明確的response對象時,會通過識別請求的類型構造出相應的response對象。
                  <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>

                              哎呀哎呀视频在线观看