當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Response::getLastModified方法代碼示例

本文整理匯總了PHP中Symfony\Component\HttpFoundation\Response::getLastModified方法的典型用法代碼示例。如果您正苦於以下問題:PHP Response::getLastModified方法的具體用法?PHP Response::getLastModified怎麽用?PHP Response::getLastModified使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Component\HttpFoundation\Response的用法示例。


在下文中一共展示了Response::getLastModified方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getLastModified

 /**
  * @return \DateTime
  */
 protected function getLastModified()
 {
     if ($this->response === null) {
         return null;
     }
     return $this->response->getLastModified();
 }
開發者ID:ndrx-io,項目名稱:profiler,代碼行數:10,代碼來源:Http.php

示例2: hash

 /**
  * @param Response $response
  *
  * @return string
  */
 public function hash(Response $response)
 {
     $suffix = '';
     // add cookies to ETag
     if ($this->request_stack->getMasterRequest()) {
         $suffix = self::ETAG_SEPARATOR . http_build_query($this->request_stack->getMasterRequest()->cookies->all());
     }
     return hash($this->algorithm, $response->getLastModified()->format(\DateTime::ISO8601) . $suffix);
 }
開發者ID:anime-db,項目名稱:cache-time-keeper-bundle,代碼行數:14,代碼來源:EtagHasher.php

示例3: logResponse

 protected function logResponse(Response $response, Request $request)
 {
     if ($response->getStatusCode() >= 500) {
         $color = LogLevel::ERROR;
     } elseif ($response->getStatusCode() >= 400) {
         $color = LogLevel::WARNING;
     } elseif ($response->getStatusCode() >= 300) {
         $color = LogLevel::NOTICE;
     } elseif ($response->getStatusCode() >= 200) {
         $color = LogLevel::INFO;
     } else {
         $color = LogLevel::INFO;
     }
     $msg = 'Response {response_status_code} for "{request_method} {request_uri}"';
     $context = array('request_method' => $request->getMethod(), 'request_uri' => $request->getRequestUri(), 'response_status_code' => $response->getStatusCode(), 'response_charset' => $response->getCharset(), 'response_date' => $response->getDate(), 'response_etag' => $response->getEtag(), 'response_expires' => $response->getExpires(), 'response_last_modified' => $response->getLastModified(), 'response_max_age' => $response->getMaxAge(), 'response_protocol_version' => $response->getProtocolVersion(), 'response_ttl' => $response->getTtl(), 'response_vary' => $response->getVary());
     $this->logger->log($color, $msg, $context);
 }
開發者ID:caxy,項目名稱:drupal-console-logging-middleware,代碼行數:17,代碼來源:RequestLoggingMiddleware.php

示例4: testSetLastModified

 public function testSetLastModified()
 {
     $response = new Response();
     $response->setLastModified(new \DateTime());
     $this->assertNotNull($response->getLastModified());
     $response->setLastModified(null);
     $this->assertNull($response->getLastModified());
 }
開發者ID:BozzaCoon,項目名稱:SPHERE-Framework,代碼行數:8,代碼來源:ResponseTest.php

示例5: createContext

 /**
  * @param Response $response
  * @param Request  $request
  *
  * @return array
  */
 protected function createContext(Response $response, Request $request)
 {
     $context = array('response_status_code' => $response->getStatusCode(), 'response_charset' => $response->getCharset(), 'response_date' => $response->getDate(), 'response_etag' => $response->getEtag(), 'response_expires' => $response->getExpires(), 'response_last_modified' => $response->getLastModified(), 'response_max_age' => $response->getMaxAge(), 'response_protocol_version' => $response->getProtocolVersion(), 'response_ttl' => $response->getTtl(), 'response_vary' => $response->getVary(), 'request_method' => $request->getMethod(), 'request_uri' => $request->getRequestUri(), 'request_route' => $request->attributes->get('_route'), 'response_time' => $this->getTime($request), 'response_memory' => $this->getMemory());
     return $context;
 }
開發者ID:Hexanet,項目名稱:MonologExtraBundle,代碼行數:11,代碼來源:ResponseLogger.php


注:本文中的Symfony\Component\HttpFoundation\Response::getLastModified方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。