php導出excl



$site_engine_root = dirname(__FILE__ ? __FILE__ : getenv('SCRIPT_FILENAME')).'/';
require_once($site_engine_root."header.php");
$shun="";


header("Content-type:application/vnd.ms-excel;charset=gbk");
$filename = $outexefilename[$do]."_".date("Y-m-d",time()).".xls";
header("Content-Disposition:attachment; filename=$filename");


 
 $shun.='<table width="90%" height="184" border="1" align="center" cellpadding="0" cellspacing="0">
  <col width="150">
  <col width="58">
  <col width="55">
  <col width="47">
  <col width="88">
  <col width="67">
  <col width="47">
  <col width="61">
  <col width="88">
  <col width="67">
  <col width="58">
  <col width="67">
  <col width="72">
  <col width="77">
  <col width="47">
  <col width="50">
  <tr height="57">
    <td colspan="16" height="57"><div align="center">工業和信息化部ICP備案數據抽查評估統計表--各接入服務商備案信息準確率總體情況</div></td>
  </tr>
  <tr height="42">
    <td rowspan="2" height="108" width="116"><div align="center">接入服務商名稱</div></td>
    <td colspan="2" height="42"><div align="center">接入網站情況</div></td>
    <td colspan="5" height="42"><div align="center">抽查基本情況</div></td>
    <td colspan="6" height="42"><div align="center">備案信息正確率聯合統計</div></td>
    <td colspan="2" height="42"><div align="center">主體信息正確率排名</div></td>
  </tr>
  <tr height="66">
    <td height="66" width="44"><div align="center">網站數量</div></td>
    <td height="66" width="55"><div align="center">全國排名</div></td>
    <td height="66" width="42"><div align="center">抽查總數</div></td>
    <td height="66" width="88"><div align="center">未撥通數</div></td>
    <td height="66" width="67"><div align="center">撥通率</div></td>
    <td height="66" width="47"><div align="center">不配合數</div></td>
    <td height="66"><div align="center">網站註銷數</div></td>
    <td height="66"><div align="center">主體信息正確數量</div></td>
    <td height="66" width="67"><div align="center">主體信息正確率</div></td>
    <td height="66" width="58"><div align="center">接入信息正確數量</div></td>
    <td height="66" width="67"><div align="center">接入信息正確率</div></td>
    <td height="66" width="72"><div align="center">主體與接入信息同時正確量</div></td>
    <td height="66" width="77"><div align="center">主體與接入信息同時正確率</div></td>
    <td height="66" width="71"><div align="center">省內排名</div></td>
    <td height="66" width="48"><div align="center">全國排名</div></td>
  </tr>
  <tr height="19">
    <td height="19" width="116"><div align="center">'.$piayname.'</div></td>
    <td x:num="129" height="19" width="44"><div align="center">'.$new1.'</div></td>
    <td x:num="593" height="19" width="55"><div align="center">'.$new2.'</div></td>
    <td x:num="5" height="19" width="42"><div align="center">'.$new3.'</div></td>
    <td x:num="1" height="19" width="88"><div align="center">'.$new4.'</div></td>
    <td x:num="0.8" height="19" width="67"><div align="center">'.$new5.'%</div></td>
    <td x:num="0" height="19" width="47"><div align="center">'.$new6.'</div></td>
    <td x:num="0" height="19"><div align="center">'.$new7.'</div></td>
    <td x:num="4" height="19"><div align="center">'.$new8.'</div></td>
    <td x:num="1" height="19" width="67"><div align="center">'.$new9.'%</div></td>
    <td x:num="4" height="19" width="58"><div align="center">'.$new10.'</div></td>
    <td x:num="1" height="19" width="67"><div align="center">'.$new11.'%</div></td>
    <td x:num="4" height="19" width="72"><div align="center">'.$new12.'</div></td>
    <td x:num="1" height="19" width="77"><div align="center">'.$new13.'%</div></td>
    <td x:num="1" height="19" width="71"><div align="center">'.$new14.'</div></td>
    <td x:num="1" height="19" width="48"><div align="center">'.$new15.'</div></td>
  </tr>
</table>
';
 


if( $SESSION[uid] == 1 )
{
 $sql="select * from {$tablepre}userd where 1 order by id desc ";
 }
 else
 {
$sql="select * from {$tablepre}userd where uid=".$SESSION[uid]." order by id desc ";
}
 $result = $db->fetchAssocArrBySql($sql);
 foreach($result[0] as $k => $v)
{
//$$k=iconv("utf-8","gbk",$v."\t");

if($k=='new2'||$k=='new4'||$k=='new6'||$k=='new8'||$k=='new10'||$k=='new12'||$k=='new14'||$k=='new16')
{
$$k=number_format($v*100, 2, '.', '')."%";
}
else{$$k=$v;}


 
 $shun.='<br><br><br><br>
 <table width="95%" height="141" border="1" align="center" cellpadding="0" cellspacing="0">

</table>
';
 echo $shun;exit;
}
   
?>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章