<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之旅 廣告
                ## 注解路由 新版本提供了一種最簡單的路由注冊方法(可以完成基本的路由定義),默認關閉,如果需要開啟在應用的`app.php`配置文件中設置: ~~~ // 使用注解路由 'route_annotation' => true, ~~~ 然后只需要直接在控制器類的方法注釋中定義(通常稱之為**注解路由**),例如: ~~~ <?php namespace app\index\controller; class Index { /** * @param string $name 數據名稱 * @return mixed * @route('hello/:name') */ public function hello($name) { return 'hello,'.$name; } } ~~~ 請務必注意注釋的規范,可以利用IDE生成規范的注釋。 >[danger] 該方式定義的路由在調試模式下面實時生效,部署模式則需要使用 `optimize:route` 指令生成路由規則文件。 注意必須嚴格使用`@route(`(區分大小寫,`route`和`(`之間不能有空格),**建議路由定義寫在注釋最后一段,否則后面需要一個空行**。 然后就使用下面的URL地址訪問: ~~~ http://tp5.com/hello/thinkphp ~~~ 頁面輸出 ~~~ hello,thinkphp ~~~ 默認注冊的路由規則是支持所有的請求,如果需要指定請求類型,可以在第二個參數中指定請求類型: ~~~ <?php namespace app\index\controller; class Index { /** * @param string $name 數據名稱 * @return mixed * @route('hello/:name','get') */ public function hello($name) { return 'hello,'.$name; } } ~~~ 如果有路由參數和變量規則需要定義,可以直接在后面添加方法,例如: ~~~ <?php namespace app\index\controller; class Index { /** * @param string $name 數據名稱 * @route('hello/:name','get') * ->https() * ->pattern(['name' => '\w+']) * * @return mixed */ public function hello($name) { return 'hello,'.$name; } } ~~~ > 注意在添加路由參數和變量規則的最后不需要加`;`,并且確保和后面的其它注釋之間間隔一個空行。 支持在類的注釋里面定義資源路由,例如: ~~~ <?php namespace app\index\controller; /** * @route('blog') */ class Blog { public function index() { } public function read($id) { } public function edit($id) { } } ~~~
                  <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>

                              哎呀哎呀视频在线观看