示例#1
0
 public function sendHeaders()
 {
     if (headers_sent()) {
         throw new \LogicException('Headers already send');
     }
     header("HTTP/1.1 {$this->getHttpCode()}");
     header("Content-Type:{$this->getContentType()}; charset={$this->getCharset()}");
     header("Content-Language: {$this->getLanguage()}");
     header("X-Response-Date: " . Header::toGmtDate());
     $modified = $this->getModified();
     Header::modified($modified);
     $cacheTime = $this->getTimeToCache();
     if ($cacheTime > 0) {
         Header::cache($cacheTime);
     } elseif ($cacheTime < 0) {
         Header::noCache();
     }
     header("ETag: {$this->getEtag()}");
 }