Home  >  Article  >  Backend Development  >  怎么不生成.DOC文件的情况提供下载

怎么不生成.DOC文件的情况提供下载

WBOY
WBOYOriginal
2016-06-13 13:50:13750browse

如何不生成.DOC文件的情况提供下载
现在要做这样一个功能,在点击的时候提取数据库内容,并下载成.DOC文件
但是在服务器上不要生成文件,只有在点击的时候在缓存里直接生成文件并下载

目前生成文件并下载我已经做到了

就是不知道如何不在生成文件的情况下直接点击下载



------解决方案--------------------
在HEADER配置完以后,直接用echo $content
$content就是你需要的内容,可以先组织好了,一下打出来就可以了.这其实是跟读文件同样的道理,只是不用生成文件.
------解决方案--------------------
[code=php]
header("Content-type: application/msword");
echo "这里放入存了文档内容的变量";
[/code]

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn