<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智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ## 請求方法 Every HTTP request has a method that is typically one of: * GET * POST * PUT * DELETE * HEAD * PATCH * OPTIONS You can inspect the HTTP request’s method with the Request object method appropriately named`getMethod()`. > 您可以使用適當命名為`getMethod()`的請求對象方法來檢查HTTP請求的方法。 ~~~php $method = $request->getMethod(); ~~~ It is possible to fake or*override*the HTTP request method. This is useful if, for example, you need to mimic a`PUT`request using a traditional web browser that only supports`GET`or`POST`requests. > 可以偽造或`覆蓋`HTTP請求方法。例如,如果您需要使用只支持`GET`或`POST`請求的傳統web瀏覽器來模擬`PUT`請求,這是非常有用的。 > **Heads Up!** **注意!** To enable request method overriding the [Method Overriding Middleware ](http://www.hmoore.net/dehuadong/slim4/1331999) must be injected into your application. > 要啟用請求方法覆蓋,必須將`方法覆蓋中間件`注入到應用程序中。 > There are two ways to override the HTTP request method. You can include a`METHOD`parameter in a`POST`request’s body. The HTTP request must use the`application/x-www-form-urlencoded`content type. > 有兩種方法覆蓋HTTP請求方法。您可以在`POST`請求的正文中包含一個`方法`參數。HTTP請求必須使用`application/x-www-form-urlencoded`內容類型。 ~~~bash POST /path HTTP/1.1 Host: example.com Content-type: application/x-www-form-urlencoded Content-length: 22 data=value&_METHOD=PUT ~~~ Figure 3: Override HTTP method with \_METHOD parameter. You can also override the HTTP request method with a custom`X-Http-Method-Override`HTTP request header. This works with any HTTP request content type. > 您還可以使用自定義的`X-Http-Method-Override`HTTP請求頭來覆蓋HTTP請求方法。這適用于任何HTTP請求內容類型。 ~~~bash POST /path HTTP/1.1 Host: example.com Content-type: application/json Content-length: 16 X-Http-Method-Override: PUT {"data":"value"} ~~~ Figure 4: Override HTTP method with X-Http-Method-Override header. ## The Request URI 請求URI Every HTTP request has a URI that identifies the requested application resource. The HTTP request URI has several parts: > 每個HTTP請求都有一個URI來標識所請求的應用程序資源。HTTP請求URI有幾個部分: * Scheme (e.g.`http`or`https`) * Host (e.g.`example.com`) * Port (e.g.`80`or`443`) * Path (e.g.`/users/1`) * Query string (e.g.`sort=created&dir=asc`) You can fetch the PSR-7 Request object’s[URI object](http://www.php-fig.org/psr/psr-7/#3-5-psr-http-message-uriinterface)with its`getUri()`method: > 你可以用它的`getUri()`方法獲取PSR-7請求對象的[URI object](http://www.php-fig.org/psr/psr-7/#3-5-psr-http-message-uriinterface): ~~~php $uri = $request->getUri(); ~~~ The PSR-7 Request object’s URI is itself an object that provides the following methods to inspect the HTTP request’s URL parts: > PSR-7請求對象的URI本身就是一個對象,它提供以下方法來檢查HTTP請求的URL部分: * getScheme() * getAuthority() * getUserInfo() * getHost() * getPort() * getPath() * getBasePath() * getQuery()(returns the full query string, e.g.`a=1&b=2`) * getFragment() * getBaseUrl() You can get the query parameters as an associative array on the Request object using`getQueryParams()`. > 可以使用`getQueryParams()`將查詢參數作為請求對象上的關聯數組獲取。 **Base Path** If your Slim application's front-controller lives in a physical subdirectory beneath your document root directory, you can fetch the HTTP request's physical base path (relative to the document root) with the Uri object's`getBasePath()`method. This will be an empty string if the Slim application is installed in the document root's top-most directory. > **Base Path** > > 如果Slim應用程序的前端控制器位于文檔根目錄下的物理子目錄中,則可以使用Uri對象的`getBasePath()`方法獲取HTTP請求的物理基路徑(相對于文檔根目錄)。如果Slim應用程序安裝在文檔根目錄的最上面的目錄中,那么這將是一個空字符串。
                  <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>

                              哎呀哎呀视频在线观看