gb_admin::abrupt_rsp PHP Method

abrupt_rsp() static public method

static public abrupt_rsp ( $body = '', $status = '200 OK', $content_type = 'text/plain; charset=utf-8', $exit = true )
    static function abrupt_rsp($body = '', $status = '200 OK', $content_type = 'text/plain; charset=utf-8', $exit = true)
    {
        if (!$body) {
            $body = '';
        }
        if (!headers_sent()) {
            if ($status) {
                header('HTTP/1.1 ' . $status);
            }
            if ($body) {
                if ($content_type) {
                    header('Content-Type: ' . $content_type);
                }
                header('Content-Length: ' . strlen($body));
            }
            header('Cache-Control: no-cache');
        }
        if ($exit) {
            exit($body);
        }
        echo $body;
    }