PHP Small Code---separate log records from slow log files and store them in an Excel file
GetProperties ()->settitle ("Export")->setdescription ("none"); $objPHPExcel->setactivesheetindex (0); $ Objphpexcel->getactivesheet ()->getcolumndimension (' A ')->setwidth, $objPHPExcel->getactivesheet ( )->getcolumndimension (' B ')->setwidth (+), $objPHPExcel->getactivesheet ()->getcolumndimension (' C ')- >setwidth, $objPHPExcel->getactivesheet ()->getcolumndimension (' D ')->setwidth ($objPHPExcel- >getactivesheet ()->getcolumndimension (' E ')->setwidth, $objPHPExcel->getactivesheet () Getcolumndimension (' F ')->setwidth (), $objPHPExcel->getactivesheet ()->getcolumndimension (' G ') SetWidth, $objPHPExcel->getactivesheet ()->getcolumndimension (' H ')->setwidth (15); $titlearray = Array ("host information" = ' user@host ', "query time" = ' query_time ', "lock table time" = ' lock_time ', "Check row count when querying" = ' rows_examined ', ' read rows ' = ' rows_read ', ' time ' = ' timestamp ', ' send bytes ' = ' bytes_sent ', ' Execute SQL ' = ' sql '; $col = 0;foreach($titlearray as $key = $title) {$objPHPExcel->getactivesheet ()->setcellvaluebycolumnandrow ($col, 1, $key); $col + +;} $j = 2;foreach ($slowData as $key = = $SD) {$col = 0; foreach ($titlearray as $key 2 = $title) {$objPHPExcel->getactivesheet ()->setcellvaluebycolumnandrow ($col , $j, $SD [$title]); $col + +; } $j + +;} $objPHPExcel->setactivesheetindex (0); $objWriter = Iofactory::createwriter ($objPHPExcel, ' Excel5 ');//Sending Headers to force the user to download the Fileheader (' Content-type:application/vnd.ms-excel '); Header (' Content-disposition:attachment;filename= "Slowsql.xls"); header (' cache-control:max-age=0 '); $objWriter->save ( ' Php://output ');
http://www.bkjia.com/PHPjc/1055412.html www.bkjia.com true http://www.bkjia.com/PHPjc/1055412.html techarticle PHP Small Code---separate log records from slow log files and store them in an Excel file? PHP header (content-type:text/html; charset=utf-8); Ini_set (Max_execution_ Time, 10000); Ini_set (Memor ...