Exemplo n.º 1
0
function toHTML($strfilename)
{
    $rl = new LogAnalysis();
    //$dir = "C:\Users\N010D90001\Downloads\0315.log";
    $fileName = iconv('UTF-8', 'GBK', $strfilename);
    $files = array($fileName);
    $logdate = $rl->getLogDate($files[0]);
    $title = '掌上链家API日志统计 ' . $logdate;
    $html = <<<HTML
<html>
        <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>{$title}</title>
        </head>
<style type="text/css">
body {font-size: 12px; font-family: Arial, Helvetica, sans-serif; }
table#dd {background-color: #6CADD9;white-space:nowrap;}
table#dd thead th {background-color: #6CADD9;color: #FFFFFF;font-size: 12px;text-align:center;}
table#dd td {padding: 6px;width: 120px;}
table#dd tbody.tb1 td {background-color: #FFFFFF;}
table#dd tbody.tb2 td {background-color: #F7F7F7;}
table#dd tbody td:hover {background-color: #BFEDF9;}
table#dd tbody td ul {list-style-type:none;margin:0px;padding:0px;}
center {font-size: 24px;margin:50px}
</style>
<body>
<center>{$title}</center>
HTML;
    $arr = $rl->getContentFromFile($files);
    ksort($arr);
    $html .= $rl->arrayToTable($arr);
    $html . '</body></html>';
    header("Content-Type: text/html; charset=utf-8");
    echo $html;
}