showErrorPage(); } else { $this->showErrorJson(); } } private function showErrorJson() { $exception['errno'] = $this->code; $exception['msg'] = $this->message; @header('Content-type: application/json; charset=utf-8'); exit(json_encode($exception)); } private function showErrorPage() { $message = $this->message; $code = $this->code; require dirname(dirname(__FILE__))."/templates/error.tpl.php"; exit; } }