<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智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                批量注冊路由規則可以使用兩種方式,包括方法注冊和路由配置定義。 ## 批量注冊 如果不希望一個個注冊,可以使用批量注冊,規則如下: ~~~ Route::rule([ '路由規則1'=>'路由地址和參數', '路由規則2'=>['路由地址和參數','匹配參數(數組)','變量規則(數組)'] ... ],'','請求類型','匹配參數(數組)','變量規則'); ~~~ 如果在外面和規則里面同時傳入了匹配參數和變量規則的話,路由規則定義里面的最終生效,但請求類型參數以最外層決定,例如: ~~~ Route::rule([ 'new/:id' => 'News/read', 'blog/:id' => ['Blog/update',['ext'=>'shtml'],['id'=>'\d{4}']], ... ],'','GET',['ext'=>'html'],['id'=>'\d+']); ~~~ 以上的路由注冊,最終`blog/:id`只會在匹配shtml后綴的訪問請求,id變量的規則則是 `\d{4}`。 > 如果不同的請求類型的路由規則是一樣的,為了避免數組索引沖突的問題,請使用單獨的請求方法定義路由。 同樣,我們也可以使用其他幾個注冊方法進行批量注冊。 ~~~ // 批量注冊GET路由 Route::get([ 'new/:id' => 'News/read', 'blog/:id' => ['Blog/edit',[],['id'=>'\d+']] ... ]); // 效果等同于 Route::rule([ 'new/:id' => 'News/read', 'blog/:id' => ['Blog/edit',[],['id'=>'\d+']] ... ],'','GET'); ~~~ ## 定義路由配置文件 除了支持動態注冊,也可以直接在應用目錄下面的`route.php` 的最后通過返回數組的方式直接定義路由規則,內容示例如下: ~~~ return [ 'new/:id' => 'News/read', 'blog/:id' => ['Blog/update',['method' => 'post|put'], ['id' => '\d+']], ]; ~~~ 路由配置文件定義的路由規則效果和使用`any`注冊路由規則一樣。 路由動態注冊和配置定義的方式可以共存,例如: ~~~ use think\Route; Route::rule('hello/:name','index/index/hello'); return [ 'new/:id' => 'News/read', 'blog/:id' => ['Blog/update',['method' => 'post|put'], ['id' => '\d+']], ]; ~~~ 默認情況下,只會加載一個路由配置文件`route.php`,如果你需要定義多個路由文件,可以修改`route_config_file`配置參數,例如: ~~~ // 定義路由配置文件(數組) 'route_config_file' => ['route', 'route1', 'route2'], ~~~ 如果存在相同的路由規則,一樣可以參考前面的批量注冊方式進行定義。 > 由于檢測機制問題,動態注冊的性能比路由配置要高一些,尤其是多種請求類型混合定義的時候。
                  <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>

                              哎呀哎呀视频在线观看