<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>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # # 以 / 結尾的路由模式 Slim treats a URL pattern with a trailing slash as different to one without. That is,`/user`and`/user/`are different and so can have different callbacks attached. > Slim將帶結尾斜杠的URL模式視為與不帶結尾斜杠的URL模式不同。也就是說,`/use`r和`/user/`是不同的,因此可以附加不同的回調。 For GET requests a permanent redirect is fine, but for other request methods like POST or PUT the browser will send the second request with the GET method. To avoid this you simply need to remove the trailing slash and pass the manipulated url to the next middleware. > 對于GET請求,可以使用永久重定向,但是對于POST或PUT等其他請求方法,瀏覽器將使用GET方法發送第二個請求。要避免這種情況,只需刪除后面的斜杠并將處理后的url傳遞給下一個中間件。 If you want to redirect/rewrite all URLs that end in a`/`to the non-trailing`/`equivalent, then you can add this middleware: > 如果你想重定向/重寫所有以`/`結尾的url到非尾隨`/`等效,那么你可以添加這個中間件: ~~~ <?php use Psr\Http\Message\RequestInterface as Request; use Psr\Http\Server\RequestHandlerInterface RequestHandler; use Slim\Factory\AppFactory; use Slim\Psr7\Response; require __DIR__ . '/../vendor/autoload.php'; $app = AppFactory::create(); $app->add(function (Request $request, RequestHandler $handler) { $uri = $request->getUri(); $path = $uri->getPath(); if ($path != '/' && substr($path, -1) == '/') { // permanently redirect paths with a trailing slash // to their non-trailing counterpart $uri = $uri->withPath(substr($path, 0, -1)); if ($request->getMethod() == 'GET') { $response = new Response(); return $response ->withHeader('Location', (string) $uri) ->withStatus(301); } else { $request = $request->withUri($uri); } } return $handler->handle($request); }); ~~~ > 或者,考慮[middlewares/trailing-slash](http://github.com/middlewares/trailing-slash)中間件,它也允許您強制將一個尾隨斜杠附加到所有url: Alternatively, consider[middlewares/trailing-slash](http://github.com/middlewares/trailing-slash)middleware which also allows you to force a trailing slash to be appended to all URLs: ~~~ use Middlewares\TrailingSlash; $app->add(new TrailingSlash(true)); //true添加結尾的斜杠(false刪除它) // true adds the trailing slash (false removes it) ~~~
                  <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>

                              哎呀哎呀视频在线观看