For example: Download the output file size, file name, etc.The premise is that the. htaccess file is configured to add a sentenceSetenv No-gzip Dont-varyis to not compress files against the file
Example 1
The code is as follows
Copy
The header () function sends the original HTTP header to the client.
Copy Code code as follows:
200 normal state
Header (' http/1.1 OK ');
301 permanent Redirect, remember to add a redirect to the following address Location: $url
The caching of the Web page is controlled by the "Cache-control" in the HTTP message header, the common value has private, No-cache, Max-age, must-revalidate, etc., the default is private. Its role is divided into the following situations according
Copy Code code as follows:
/*** function:php Header () examples (PHP)
* * Desc:some examples on the header () function of phpyou find a detailed tutorial at expertsrt.com (中文版) o R at Ffm.junetz.de (German). These are also a good help about
The caching of the Web page is controlled by the "Cache-control" in the HTTP message header, the common value has private, No-cache, Max-age, must-revalidate, etc., the default is private. Its role is divided into the following situations according
Provides various official and user-released code examples. For code reference, you are welcome to exchange and learn. In general, we can direct the URL to a file under the Document Root to guide users to download files.
However, in this way, we can'
From: http://hi.baidu.com/nathena/blog/item/d9b169fd422cc71e09244dd9.html
The downloaded file name is garbledScenario 11. GBK File2. The downloaded file name does not contain spaces.The following code// GBK charset$ Filename = "GBK file. The file
However, in this way, we can't do some statistics, permission checks, and so on. So, in many cases, we use PHP for forwarding to provide users with file downloads.
Copy codeThe Code is as follows: $ File = "/tmp/dummy.tar.gz ";
Header ("Content-type:
In general, we can direct the URL to a file under DocumentRoot to guide users to download the file.
In general, we can direct the URL to a file under the Document Root to guide users to download the file.
However, in this way, we can't do some
: This article describes how to set an http packet header using the phphpheader function. if you are interested in the PHP Tutorial, refer to it.
// Define the encoding headers ('content-Type: text/html; charset = utf-8 '); // Atomheader
Here is the download, refers to the pop-up download prompt box.The first type:?
1234567891011121314
function downfile(){ $filename=realpath("resume.html"); //文件名 $date=date("Ymd-H:i:m"); Header( "Content-type:
In general, we can direct the user to download files by directly having the URL point to a file located under document root.
However, in doing so, there is no way to do some statistics, permission checks, etc. work. So, a lot of times, we use to
On the microblog to see an introduction to PHP faster download file method, in fact, the use of Web server xsendfile features, bird Brother's blog only said the Apache implementation, I found the introduction of nginx implementation of the article,
In general, we can direct the URL to a file under DocumentRoot to guide the user to download the file. However, in this way, there is no way to do some statistics, permission checks, and so on. therefore, we often use PHP for forwarding to provide
PHP allows users to download files faster. In general, we can direct the URL to a file under DocumentRoot to guide users to download the file. However, in this way, we can't make some statistics. In general, we can direct the URL to a file under the
PHP provides faster code for file download. However, in this way, we can't do some statistics, permission checks, and so on. therefore, we often use PHP for forwarding to provide users with file downloads. copy the code, for example, but, in this
However, in this way, we can't do some statistics, permission checks, and so on. So, in many cases, we use PHP for forwarding to provide users with file downloads.Copy codeThe Code is as follows:$ File = "/tmp/dummy.tar.gz ";Header ("Content-type:
In general, we can direct the user by directing the URL directly to a file located under the document root
Download File。
However, to do so, there is no way to do some statistics, permission checks, and so on. So, many times, we use to let PHP to
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.