<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之旅 廣告
                ## 重定向 可以使用`redirect`助手函數進行重定向 ~~~ <?php namespace app\controller; class Index { public function hello() { return redirect('http://www.thinkphp.cn'); } } ~~~ ### 重定向傳參 如果是站內重定向的話,可以支持URL組裝,有兩種方式組裝URL,第一種是直接使用完整地址(`/`打頭) ~~~ redirect('/index/hello/name/thinkphp'); ~~~ 如果你需要自動生成URL地址,應該在調用之前調用url函數先生成最終的URL地址。 ~~~ redirect((string) url('hello',['name' => 'think'])); ~~~ 還可以支持使用`with`方法附加`Session`閃存數據重定向。 ~~~ <?php namespace app\controller; class Index { public function index() { return redirect('/hello')->with('name','thinkphp'); } public function hello() { $name = session('name'); return 'hello,'.$name.'!'; } } ~~~ 從示例可以看到重定向隱式傳值使用的是`Session`閃存數據隱式傳值,并且**僅在下一次請求有效**,再次訪問重定向地址的時候無效。 ### 記住請求地址 在很多時候,我們重定向的時候需要記住當前請求地址(為了便于跳轉回來),我們可以使用`remember`方法記住重定向之前的請求地址。 下面是一個示例,我們第一次訪問`index`操作的時候會重定向到`hello`操作并記住當前請求地址,然后操作完成后到`restore`方法,`restore`方法則會自動重定向到之前記住的請求地址,完成一次重定向的回歸,回到原點!(再次刷新頁面又可以繼續執行) ~~~ <?php namespace app\controller; class Index { public function index() { // 判斷session完成標記是否存在 if (session('?complete')) { // 刪除session session('complete', null); return '重定向完成,回到原點!'; } else { // 記住當前地址并重定向 return redirect('hello') ->with('name', 'thinkphp') ->remember(); } } public function hello() { $name = session('name'); return 'hello,' . $name . '! <br/><a href="/index/index/restore">點擊回到來源地址</a>'; } public function restore() { // 設置session標記完成 session('complete', true); // 跳回之前的來源地址 return redirect()->restore(); } } ~~~
                  <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>

                              哎呀哎呀视频在线观看