<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智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                #### 參數綁定 雖然提供了助手函數,在操作方法中讀取請求變量的方式還是比較麻煩,使用參數綁定可以進一步簡化請求變量的讀取,我們通過hello方法的代碼來對比下前后兩種請求變量的獲取方式。 不使用參數綁定的方式: ~~~ <?php namespace app\index\controller; class Index { public function hello() { // 獲取當前的請求變量 return request()->param('name'); } } ~~~ 使用參數綁定的方式: ~~~ <?php namespace app\index\controller; class Index { public function hello($name = '') { // 獲取當前請求的name變量 return $name; } } ~~~ 顯而易見使用參數綁定方式的代碼更簡潔,我們給hello方法添加了name參數,會自動綁定當前請求變量中的name變量(并且支持全局的變量過濾),這種方式就稱之為參數綁定。 > 注意:這里給了默認值可以避免當前請求沒有傳入name變量的時候出錯,記得始終給參數定義一個默認值可以避免當前請求沒有傳值的時候拋出異常。 默認情況下,操作方法的參數定義順序對參數綁定的參數沒有影響,參數綁定只是根據參數名自動綁定,如果我們定義了多個參數: ~~~ <?php namespace app\index\controller; class Index { public function hello($name = '', $id = 0) { return $name . ':' . $id; } } ~~~ 下面的URL訪問都是有效的 ~~~ http://tp5.com/index/index/hello/name/thinkphp/id/10 http://tp5.com/index/index/hello/id/10/name/thinkphp ~~~ 設置了參數順序綁定的話(所有URL相關的配置必須在應用配置文件中設置): ~~~ // URL參數按順序解析 'url_param_type' => 1, ~~~
                  <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>

                              哎呀哎呀视频在线观看