芝麻web文件管理V1.00
编辑当前文件:/home/mgatv524/public_html/mctv/lib/Helper/HttpCacheProvider.php
withHeader('Cache-Control', $headerValue); } /** * Disable client-side HTTP caching * * @param ResponseInterface $response PSR7 response object * * @return ResponseInterface A new PSR7 response object with `Cache-Control` header */ public function denyCache(ResponseInterface $response) { return $response->withHeader('Cache-Control', 'no-store,no-cache'); } /** * Add `Expires` header to PSR7 response object * * @param ResponseInterface $response A PSR7 response object * @param int|string $time A UNIX timestamp or a valid `strtotime()` string * * @return ResponseInterface A new PSR7 response object with `Expires` header * @throws InvalidArgumentException if the expiration date cannot be parsed */ public function withExpires(ResponseInterface $response, $time) { if (!is_integer($time)) { $time = strtotime($time); if ($time === false) { throw new InvalidArgumentException('Expiration value could not be parsed with `strtotime()`.'); } } return $response->withHeader('Expires', gmdate('D, d M Y H:i:s T', $time)); } /** * Add `ETag` header to PSR7 response object * * @param ResponseInterface $response A PSR7 response object * @param string $value The ETag value * @param string $type ETag type: "strong" or "weak" * * @return ResponseInterface A new PSR7 response object with `ETag` header * @throws InvalidArgumentException if the etag type is invalid */ public function withEtag(ResponseInterface $response, $value, $type = 'strong') { if (!in_array($type, ['strong', 'weak'])) { throw new InvalidArgumentException('Invalid etag type. Must be "strong" or "weak".'); } $value = '"' . $value . '"'; if ($type === 'weak') { $value = 'W/' . $value; } return $response->withHeader('ETag', $value); } /** * Add `Last-Modified` header to PSR7 response object * * @param ResponseInterface $response A PSR7 response object * @param int|string $time A UNIX timestamp or a valid `strtotime()` string * * @return ResponseInterface A new PSR7 response object with `Last-Modified` header * @throws InvalidArgumentException if the last modified date cannot be parsed */ public function withLastModified(ResponseInterface $response, $time) { if (!is_integer($time)) { $time = strtotime($time); if ($time === false) { throw new InvalidArgumentException('Last Modified value could not be parsed with `strtotime()`.'); } } return $response->withHeader('Last-Modified', gmdate('D, d M Y H:i:s T', $time)); } }