<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之旅 廣告
                ## Route placeholders路線占位符 Each routing method described above accepts a URL pattern that is matched against the current HTTP request URI. Route patterns may use named placeholders to dynamically match HTTP request URI segments. > 上面描述的每個路由方法都接受一個與當前HTTP請求URI匹配的URL模式。路由模式可以使用命名占位符來動態匹配HTTP請求URI段。 ### Format格式化 A route pattern placeholder starts with a `{` , followed by the placeholder name, ending with a `}` . This is an example placeholder named `name` : > 路由模式占位符以`{`開頭,后跟占位符名稱,以`}`結尾。這是一個名為`name`的占位符示例: ~~~php $app->get('/hello/{name}', function (Request $request, Response $response, $args) { $name = $args['name']; echo "Hello, $name"; }); ~~~ ### Optional segments可選部分 To make a section optional, simply wrap in square brackets: > 要使一個部分可選,只需用方括號括起來: ~~~php $app->get('/users[/{id}]', function ($request, $response, $args) { // responds to both `/users` and `/users/123` // but not to `/users/` }); ~~~ Multiple optional parameters are supported by nesting: > 嵌套支持多個可選參數: ~~~php $app->get('/news[/{year}[/{month}]]', function ($request, $response, $args) { // reponds to `/news`, `/news/2016` and `/news/2016/03` }); ~~~ For “Unlimited” optional parameters, you can do this: 對于`傳入`可選參數,你可以這樣做: ~~~php $app->get('/news[/{params:.*}]', function ($request, $response, $args) { // $params is an array of all the optional segments $params = explode('/', $args['params']); }); ~~~ In this example, a URI of`/news/2016/03/20`would result in the`$params`array containing three elements:`['2016', '03', '20']`. > 在本例中,URI`/news/2016/03/20`將導致`$params`數組包含三個元素:` ['2016','03','20']` ### Regular expression matching正則表達式匹配 By default the placeholders are written inside`{}`and can accept any values. However, placeholders can also require the HTTP request URI to match a particular regular expression. If the current HTTP request URI does not match a placeholder regular expression, the route is not invoked. This is an example placeholder named`id`that requires one or more digits. > 默認情況下占位符寫在`{}`里面,可以接受任何值。但是,占位符也可能需要HTTP請求URI來匹配特定的正則表達式。如果當前HTTP請求URI不匹配占位符正則表達式,則不會調用路由。這是一個名為`id`的占位符示例,它需要一個或多個數字。 ~~~php $app->get('/users/{id:[0-9]+}', function ($request, $response, $args) { // Find user identified by $args['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>

                              哎呀哎呀视频在线观看