原生PHP生成 excl、word文件

发布于:2020-08-08 17:33:32

<!--?php    
 
     
    /***
    * 生成excle文件
    ***/
    $time = time(); 
    $filename = date("Y年m月d日h点m分s秒", $time).'问卷数据';
    $rows =  Sp_Looks_Vote::downvote();
    $file = $filename.".csv";
    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');  
    header('Content-Disposition: attachment; filename='.basename($file));
    header('Content-Transfer-Encoding: binary');
    header('Expires: 0');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Pragma: public');
 
    $tabletitle .= "购买地址,常常购买,喜欢模特,内容如何,印象如何,是否购买,感觉如何,购买方式,购买方式建议,吸引点,改进建议";
 
    $conter = iconv('utf-8','gbk',$tabletitle)."\n";
 
    echo $conter;die;
 
 
 
 
 
    /***
    * 生成word文件
    ***/
 
    header("Content-Type:   application/msword");        
    header("Content-Disposition:   attachment;   filename=doc.doc");        
    header("Pragma:   no-cache");        
    header("Expires:   0");        
 
    $output    =   '<table border="1" cellspacing="2" cellpadding="2"  width="90%" align="center"-->';        
    $output   .=   '图片';        
    $output   .=   '<span style="color:#FF0000;"><strong>下面是一张图片</strong>';        
    $output   .=   '<img src="http://zi.csdn.net/48260_2.gif">';        
    $output   .=   '';  
 
 
    echo   $output;   
 
 
 
  ?>
</span>


阅读 98+

一片空白

父爱如山,不善表达。回想十多年前,总记得父亲有个宽厚的肩膀,小小的自己跨坐在上面,越过人山人海去看更广阔的天空,那个时候期望自己有一双翅膀,能够像鸟儿一样飞得高,看得远。虽然父亲有时会和自己开玩笑,但在做错事的时候会受到严厉的训斥。父亲有双粗糙的大手掌。