Beispiel #1
0
 /**
  * Exit with status code $code
  *
  * @throws Exception
  *  If headers are already sent
  * @param int $code
  */
 public static function server_exit($code)
 {
     $file = null;
     $line = null;
     if (!headers_sent($file, $line)) {
         $desc = Net::status_description($code);
         header("HTTP/1.1 {$code} {$desc}");
         echo "<h1>{$code} <small>{$desc}</small></h1>";
         die;
     } else {
         throw new \Exception("Headers already sent in {$file} on line {$line}!");
     }
 }