public function flush()
{
if (!headers_sent($filename, $linenum)) {
if ($this->nocache) {
header("Cache-Control: no-cache, must-revalidate");
// HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
header('Pragma: no-cache');
}
if ($this->etag) {
header('ETag: "' . md5($this->body) . '"');
}
header('HTTP/1.0 ' . $this->status . ' ' . App::$statusCodes[$this->status]);
header('Content-type: ' . App::$mimeTypes[$this->mime]);
foreach ($this->headers as $h) {
header($h);
}
echo is_array($this->body) ? json_encode($this->body) : $this->body;
}
}