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

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # HTTP Caching Slim 3 uses the optional standalone?[slimphp/Slim-HttpCache](https://github.com/slimphp/Slim-HttpCache)?PHP component for HTTP caching. You can use this component to create and return responses that contain?`Cache`,`Expires`,?`ETag`, and?`Last-Modified`?headers that control when and how long application output is retained by client-side caches. ## Installation Execute this bash command from your project’s root directory: ~~~ composer require slim/http-cache ~~~ ## Usage The?`slimphp/Slim-HttpCache`?component contains a service provider and an application middleware. You should add both to your application like this: ~~~ // Register service provider with the container $container = new \Slim\Container; $container['cache'] = function () { new \Slim\HttpCache\CacheProvider(); }; // Add middleware to the application $app = new \Slim\App($container); $app->add(new \Slim\HttpCache\Cache('public', 86400)); // Create your application routes... // Run application $app->run(); ~~~ ## ETag Use the service provider’s?`withEtag()`?method to create a Response object with the desired`ETag`?header. This method accepts a PSR7 response object, and it returns a cloned PSR7 response with the new HTTP header. ~~~ $app->get('/foo', function ($req, $res, $args) { $resWithEtag = $this->cache->withEtag($res, 'abc'); return $resWithEtag; }); ~~~ ## Expires Use the service provider’s?`withExpires()`?method to create a Response object with the desired?`Expires`?header. This method accepts a PSR7 response object, and it returns a cloned PSR7 response with the new HTTP header. ~~~ $app->get('/bar',function ($req, $res, $args) { $resWithExpires = $this->cache->withExpires($res, time() + 3600); return $resWithExpires; }); ~~~ ## Last-Modified Use the service provider’s?`withLastModified()`?method to create a Response object with the desired?`Last-Modified`?header. This method accepts a PSR7 response object, and it returns a cloned PSR7 response with the new HTTP header. ~~~ //Example route with LastModified $app->get('/foobar',function ($req, $res, $args) { $resWithLastMod = $this->cache->withLastModified($res, time() - 3600); return $resWithLastMod; }); ~~~
                  <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>

                              哎呀哎呀视频在线观看