/** * 输出调试信息 * @todo 完善各级别的调试信息输出 */ public static function outPut() { $contentType = \Helper\ResponseUtil::getHeader('content-type'); $contentType = explode(';', $contentType); $contentType = trim($contentType[0]); if (DEBUG_LEVEL === 0) { self::$debugInfo['IncludedFiles'] = get_included_files(); } switch ($contentType) { case 'text/html': case 'text/plain': continue; case 'application/json': $str = ob_get_contents(); $debugStr = json_encode(self::$debugInfo); if (strpos($str, '[') === 0) { $str = substr($str, 0, strlen($str) - 1) . ',{"debugInfo":' . $debugStr . '}]'; } else { if (strpos($str, '{') === 0) { $str = substr($str, 0, strlen($str) - 1) . ',"debugInfo":' . $debugStr . '}'; } else { $str = $debugStr; } } ob_end_clean(); echo $str; return; defautl: return; } $str = '<style type="text/css">@import url("' . IMAGE_URL . 'debug.css");</style>'; if (DEBUG_LEVEL == 0 || DEBUG_LEVEL == 2) { $str .= '<div id="milanooDebugFrame">' . self::consumption() . self::infoToStr(self::$debugInfo); } else { if (DEBUG_LEVEL === 1) { $str .= '<div id="milanooDebugFrame">' . self::consumption(); } } $str .= '</div>'; echo $str; }