PHP生成 excl、word文件

$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文档的代码贴到这里:

<?php       
  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   .=   '<tr bgcolor="#cccccc"><td   align="center">图片</td></tr>';       
  $output   .=   '<tr bgcolor="#f6f7fa"><td><span style="color:#FF0000;"><strong>下面是一张图片</strong></span& gt;</td></tr>';       
  $output   .=   '<tr><td align="center"><img src="http://zi.csdn.net/48260_2.gif"></td></tr>';       
  $output   .=   '</table>'; 
 
 
  echo   $output;       
  ?>

转载于:https://www.cnblogs.com/persy_php/archive/2010/07/21/1782407.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值