首页 > Web开发 > 详细

php 下载生成word文件

时间:2014-12-01 12:47:22      阅读:223      评论:0      收藏:0      [点我收藏+]
方案一

$html2 =‘数字‘; 

header("Content-type: application/octet-stream"); 
header("Accept-Ranges: bytes"); 
header("Accept-Length: ".strlen($html2));
header(‘Content-Disposition: attachment; filename=test.doc‘); 
header("Pragma:no-cache"); 
header("Expires:0"); 
echo $html2;
//此方法是放入缓冲区输出, 默认4096. 超出自动就输出到浏览器上了。 可以修改配置文件 output_buffering = 4096 改成 On (无限大)

$html2 = ‘实验中学‘; 

echo $html2;

ob_start();
header("Content-type: application/octet-stream"); 
header("Accept-Ranges: bytes"); 
header("Accept-Length: ".strlen($html2));
header(‘Content-Disposition: attachment; filename=test.doc‘); 
header("Pragma:no-cache"); 
header("Expires:0"); 
ob_end_clean();

 

php 下载生成word文件

原文:http://www.cnblogs.com/loveyouyou616/p/4134637.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!