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

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

Jun 13, 2016 am 10:03 AM
code content echo header quot

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

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

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



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

Statement of this Website
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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What does linux header mean? What does linux header mean? Jul 18, 2023 pm 03:34 PM

What does linux header mean?

How does SpringBoot pass parameters in the Header through Feign calls? How does SpringBoot pass parameters in the Header through Feign calls? May 16, 2023 pm 08:38 PM

How does SpringBoot pass parameters in the Header through Feign calls?

Five selected Go language open source projects to take you to explore the technology world Five selected Go language open source projects to take you to explore the technology world Jan 30, 2024 am 09:08 AM

Five selected Go language open source projects to take you to explore the technology world

Go language development essentials: 5 popular framework recommendations Go language development essentials: 5 popular framework recommendations Mar 24, 2024 pm 01:15 PM

Go language development essentials: 5 popular framework recommendations

What is the difference between html5 tag head and header? What is the difference between html5 tag head and header? Jan 17, 2022 am 11:10 AM

What is the difference between html5 tag head and header?

Implementing distributed task scheduling using Golang's web framework Echo framework Implementing distributed task scheduling using Golang's web framework Echo framework Jun 24, 2023 am 11:49 AM

Implementing distributed task scheduling using Golang's web framework Echo framework

How to use PHP header() method to adjust web pages How to use PHP header() method to adjust web pages Mar 28, 2023 pm 01:54 PM

How to use PHP header() method to adjust web pages

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 Jun 13, 2016 am 10:23 AM

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决

See all articles