Recently someone asked me to do the download file method, for the PHP method is as follows:
Copy CodeThe code is as follows:
Header ("Content-type:application/force-download");
Header ("content-disposition:attachment; Filename=ins.jpg ");
ReadFile ("
Recently, someone asked me how to download files. The php method is as follows:Copy codeThe Code is as follows:Header ("Content-Type: application/force-download ");Header ("Content-Disposition: attachment; filename=ins.jpg ");Readfile
Reprint: http://blog.csdn.net/mothz/article/details/6029810PHP//200 normal StateHeader(' http/1.1 OK ');//301 Permanent Redirect, remember to add a redirect address at the back location: $urlHeader(' http/1.1 301 Moved permanently ');//redirect , in
DescriptionA file download is provided in the Apache server, and a URL is typically used to point to a file on the server for download.Disadvantages: Can not be statistics, permission detection and other operations.1, generally use PHP to provide
How does PHP export the query end Excel PHPexcel export
User ID
User name
$ Row [0]
$ Row [1]
";} Sqlsrv_free_stmt ($ query); sqlsrv_close ($ conn);?>
Reply to discussion
An error occurred while exporting the Chinese file name in phpexcel. header ("Content-Disposition: attachment; filename = $ filename ");
$ If filename is Chinese, the downloaded file is. php in English.
Reply to discussion (solution)
1. generate EXCEL files without using COM in PHP
CopyCode The Code is as follows: Header ("Content-Type: Application/vnd. MS-excel ");
Header ("content-Disposition: filename=test.xls ");
Echo "test1 \ t ";
Echo "Test2 \ t \ n ";
Echo "test1 \ t ";
Header ()Is used to send raw HTTPHeaders. See the HTTP/1.1 specification for more information on HTTPHeaders.
Example 1:Copy codeThe Code is as follows: Header ("Location: http://www.jb51.net ";);Exit; // after each redirection, you must add "exit"
Php implements 301 redirection jump code. In php, the 301 redirection implementation method is very simple. we only need to simply use the header to send the 301 status code and then use the header to jump. The effect is the same as that of apache,
Use php to generate an excel file. use php alone. just pay attention to the data input method.
1. generate excel files without using COM in php
The code is as follows:
Header ("Content-type: application/vnd. ms-excel ");Header
Php downloading code is not easy to use in Apple! PHPcode $ filefopen ($ filename, & quot; r & quot;); Header (& quot; Content-type: applicationoctet-stream & quot;); Header (& quot; accept-Ranges: bytes & quo php download code, which is not easy to
Php downloading code is not easy to use in Apple! PHPcode $ filefopen ($ filename, & quot; r & quot;); Header (& quot; Content-type: applicationoctet-stream & quot;); Header (& quot; accept-Ranges: bytes & quot;); php download code, which is not
1. function file (' target file ')
Read the file in the form of an array and iterate through the array output in a circular way.
1.
2. Header (' content-type:text/html; Charset=utf-8 ');
3. $file =file ("test.txt");
4. if ($file)
5. {
6. foreach
PHPinclude("DBDA.class.php");$db=NewDbda ();$bs=$_server["Query_string"];//gets the arguments passed by the submission interface.$BSS=substr($bs, 3);//Intercept = the value behind$sql= "Select video from Shangpin where id= ' {$BSS}‘";//get the video
This article is based on RFC2616 (http/1.1 specification), referencehttp://www.w3.org/Protocols/rfc2068/rfc2068http://www.w3.org/Protocols/rfc2616/rfc2616Http://www.ietf.org/rfc/rfc3229.txtTypically HTTP messages include client-to-server request
This article is based on RFC2616 (http/1.1 specification), referencehttp://www.w3.org/Protocols/rfc2068/rfc2068http://www.w3.org/Protocols/rfc2616/rfc2616Http://www.ietf.org/rfc/rfc3229.txtTypically HTTP messages include client-to-server request
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.