<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智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                tp5路由視頻https://ke.qq.com/webcourse/index.html#course_id=235325&term_id=100277509&taid=1539754365785917&vid=f1420a94f7r 1.支持三種方式的url解析規則 2.路由只針對應用,不針對模塊(路由設置也是針對應用下所有模塊) 3.如果某個模塊不進行路由解析,需要關閉它 例: //關閉admin模塊的路由(注意:寫在加載框架引導文件之后,否則報錯) \think\App::route(false); ![](https://box.kancloud.cn/f346f592ae41fcde0e9a8076a148dde7_1041x526.png) 一:普通模式 定義: 完全使用PATH_INFO方式URL; 形式: http://www.tp.com/admin.php/index/index(默認的,完整的,未設置的) 如何設置: //配置文件中 ~~~ //是否開啟路由 'url_route_on' => false, //是否強制使用路由 'url_route_must' => falese, ~~~ 二:混合模式 定義: 開啟路由,并使用路由定義+默認PATH_INFO方式混合 如何設置: ~~~ //是否開啟路由 'url_route_on' => true, //是否強制使用路由 'url_route_must' => false, ~~~ 三:強制模式 定義: 開啟路由,并必須設置路由才能訪問 如何設置: //是否開啟路由 'url_route_on' => true, //是否強制使用路由 'url_route_must' => true, #### 設置路由 設置路由格式: `Route::rule('路由表達式','路由地址','請求類型','路由參數(數組)','變量規則(數組)');` 1.動態單個注冊 1)配置文件:tp5\application\route.php 2)如何設置:![](https://box.kancloud.cn/5fa6fe8db6055e5878a495c4fef9424a_1722x303.png) (設置了路由后的頁面不能使用PATH_INFO訪問) 3)路由的形式 a.靜態地址路由 //注冊路由test 訪問到index模塊index控制器test方法 ` Route::rule('test','index/index/test');` b.給路由帶參數 //訪問到index模塊index控制器course方法并攜帶參數 ` Route::rule('course/:id','index/index/course');` 例: 路由寫法:http://www.tp.com/course/1 默認寫法:http://www.tp.com/index/index/course/id/1 c.攜帶多個參數 //如果路由設置2個參數,必須寫2個參數 //訪問到index模塊index控制器shijian方法 `Route::rule('time/:year/:month','index/index/shijian');` d.可選參數路由 //month為可選參數 ` Route::rule('time/:year/[:month]','index/index/shijian');` e.全動態路由(參數1如果是其他方法,會優先訪問到其他方法中,所有不建議使用全動態路由) `Route::rule(':a/:b','index/index/dongtai');` f.完全匹配路由(后面加上$) //后面多加參數什么的就無法訪問 ` Route::rule('test1$','index/index/test1');` g.帶額外參數 `Route::rule('test2','index/index/test2?id=10&name=zhangsan');` //打印地址欄 dump(input()); 4)路由的請求方式 1.get,post,put,delete 2.默認支持所有請求方式 //支持get請求 Route::rule('type','index/index/type','get'); Route::get('type','index/index/type'); //支持post請求 方法一:Route::rule('type','index/index/type','post'); 方法二:Route::post('type','index/index/type'); ![](https://box.kancloud.cn/0364c2ec5beab03b164511e536370a77_1104x290.png) //同時支持get和post `Route::rule('type','index/index/type','get|post');` //支持put請求類型 Route::rule('type','index/index/type','put'); Route::put('type','index/index/type); //支持delete請求 Route::rule('type','index/index/type','delete'); Route::delete('type','index/inex/delete); //支持所有類型 ~~~ Route::rule('type','index/index/type','*'); Route::any('type','index/index/type'); ~~~ 小知識: 如何模擬請求(手冊請求偽裝) ![](https://box.kancloud.cn/360c01bfa0d0401a53eff1bb96349040_504x171.png) 2.動態批量注冊 Route::rule([ '路由規則1' => '路由參數和地址', '路由規則2' => ['路由地址和參數',匹配參數(數組)','變量規則(數組)'] ... ],'','請求類型','匹配參數(數組)','變量規則' ); 例: Route::rule([ "test" => "index/index/test", "course/:id" => "index/index/course" ],'','get'); //只支持get Route::get([ "test" => "index/index/test", "course/:id" => "index/index/course" ]); 3.配置文件批量注冊 application\route.php ![](https://box.kancloud.cn/144c0b5da8dcdbc45f5660a7459a4610_897x320.png) 4.變量規則 Route::rule("course/:id/:name","index/index/course","get",[],['id'=>'\d{1,3}','name'=>'\w+']); 注: 正則 \d+ //必須為數字 \d{1,3} //必須為數字,并且1到3位數之間 \w+ //必須為字符串 5.路由參數 Route::rule("course/:id","index/index/course","get",['method'=>'get','ext'=>'html'],[]); //路由參數method 規定請求方式必須是get //路由參數ext 規定設置路由的后綴必須是html 6.資源路由 //聲明 Route::resource( 'blog','index/blog' ); //會自動注冊7個路由規則 | 標識 | 請求類型 | 生成路由規則 | 對應操作方法 | | --- | --- | --- | --- | | index | ge | blog | index | | create | get | blog/create | create | | save | post | blog | save | | read | get | blog/:id | read | | edit | get | blod/:id | edit | | update | put | blod/:id | update | | delete | delete | blod/:id | delete | 7.
                  <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>

                              哎呀哎呀视频在线观看