示例#1
0
 /**
  * Send HTTP headers
  *
  * @param KDispatcherResponseInterface $response
  * @return KDispatcherResponseTransportAbstract
  */
 public function sendHeaders(KDispatcherResponseInterface $response)
 {
     if (!headers_sent()) {
         //Send the status header
         header(sprintf('HTTP/%s %d %s', $response->getVersion(), $response->getStatusCode(), $response->getStatusMessage()));
         //Send the other headers
         $headers = explode("\r\n", trim((string) $response->headers));
         foreach ($headers as $header) {
             header($header, false);
         }
     }
     return $this;
 }