PHP header to define a PHP page for UTF encoding or GBK encoding
PHP page for UTF encoding
Header ("content-type:text/html; Charset=utf-8 ");
PHP page for GBK encoding
Header ("content-type:text/html; charset=gb2312 ");
PHP page for BIG5
The code is as follows
Copy Code
Class excel{var $header = ""xmlns:x= "Urn:schemas-microsoft-com:office:excel"Xmlns:ss= "Urn:schemas-microsoft-com:office:spreadsheet"Xmlns:html= "HTTP://WWW.W3.ORG/TR/REC-HTML40" > "; var $footer = ""
Focus:
1, in IE to download the attachment before you want to empty the cache.
2, Chinese file name to use UrlEncode encoding.
Copy Code code as follows:
Header ("Pragma:"); If not, IE will prompt the target host to be inaccessible
Summary of HTTP protocol and common methods used by headers in PHP, and Header Summary
This example summarizes the HTTP protocol used by the Header in PHP and common methods. Share it with you for your reference. The specific method is as
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
You need to implement click button and get information to download the content as a file.
But now click on the button to open a new window and show the content instead of ejecting the download window.
The code is as follows:
$filename =
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 fact, is 302 temporary redirectHeader ('
PHP generates Excel files This article collects three PHP generated Excel file code program, the first is a more comprehensive generation function, the following two is very simple, but not as good as the first, OK now look at the principle of
PHP download instructions & lt ;? Php?file="=koala.jpg & quot; if (file_exists ($ file) {header ('content-Description: FileTransfer '); // What is corresponding to the content description? the header is not clear ('cont PHP download instructions
First, PHP webpage code1. The php Tutorial file encoding should match the webpage encoding.A. if you want to use gb2312 encoding, php needs to output the header: header ("Content-Type: text/html; charset = gb2312 "), add to the static page. All
Original StyleOriginal method: Send the header, and send the header of the attachment to the user's browser to indicate that the object is to be downloaded. Then, read the data in the database, parse it one by one, and write it into an excel file.
In the PHP pop-up save dialog box, the problem is as follows:
You need to save the queried table and set it to Excel. the content written to Excel has been completed,
Mainly: 1. when you click Export as Excel, you want to display a selection box for
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
If you want to use the PHP output Excel format file, you must use header Content-type:application/vnd.ms-excel to achieve. As follows
The code is as follows
Copy Code
$filename = name. '. XLS ';Header
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.