The basic use method is divided into three parts:First, the introduction of interfacesPhpexcel_iofactoryRequire_once dirname (__file__). ' /classes/phpexcel/iofactory.php ';Ii. defining an Excel entityDefines a Phpexcel object and sets the contents
One problem encountered in the middle is that the submitted Chinese file name is directly put in the header and will become garbled characters in IE. The solution is to urlencode the file name first and then put it in the header, as shown below.Copy
This article mainly introduces a way to make file downloads faster in PHP, that is, using the X-SendFile header, which is supported by servers with active traffic, in general, we can direct the URL to a file under the Document Root to guide users to
Use of phpheader, Summary of common PHP header states. The header () function sends the original HTTP header to the client.
The code is as follows:
// 200 normal statusHeader ('http/1.1 200 OK ');// 301 permanent redirection. remember to add the
Use the X-SendFile header in PHP to make file download 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
The following code submits data and file names in excel format to the server. PHP converts requests to downloadable excel files, in addition, the browser is required to bring up the file download prompt window. a problem occurs in the middle: the
Solution to Chinese garbled characters in PHP file names downloaded in different browsers
$ Ua = $ _ SERVER ["HTTP_USER_AGENT"];
$ Filename = "Chinese file name .txt ";
$ Encoded_filename = urlencode
Summary of HTTP protocol and common methods used by headers in PHP, and Header summary. Summary of the HTTP protocol and common methods used by the Header in PHP. the header summary examples in this article summarize the HTTP protocol and common
This article mainly describes how to implement the PHP code processing pictures, interested in the reference of friends, I hope to be helpful to everyone.
First, the image scaling code
Non-proportional picture scaling code
$fileNames =
The phpheader function is commonly used for http header settings. Common http header settings for the phpheader function, and the okheader ('http1. required OK); set a 404 header: header ('http1. 1404 NotFound); set the address to be permanently
This article mainly introduces the common http header settings of the phpheader function. This article provides code examples. The Code contains detailed comments. For more information, see
// Okheader ('HTTP/1.1 200 OK '); // set a 404 header:
Header Common DirectivesThe header is divided into three parts:The first part is the version of the HTTP Protocol (http-version);
The second part is state code (status);
The third part is the reason phrase (reason-phrase).
Fix 404 Pages: Use this
$ ObjPHPExcel-& gt; getActiveSheet ()-& gt; setTitle (iconv ('gbk', 'utf-8 ′, 'data report (this table is automatically generated by the program in the data center of Guangheng) '); // you can specify the default font and size.
The basic usage is
Need to use PHP to export data into the Excel table, using the PHP Pack function to package the characters into binary, and then write to Excel table file, English characters import normal, now Chinese characters are all garbled, do not know where
In the middle of a problem is the submission of the Chinese file name directly into the header under IE will become garbled, the solution is to urlencode the file name first and then put in the header, as follows.
Copy CodeThe code is as follows:
$
To export a table from the database to Excel using Phpexcel, the table has a picture path now my code is as follows:
GetProperties (); $objProps->setcreator ("tt"); $objProps->setlastmodifiedby ("tt"); $objProps->settitle ("tt");
Use PHP CI force_download ($filename, $data) to download. csv file to resolve file name garbled, file content garbled. Did a long time finally know a good solution.
1. Loading auxiliary functions
$this->load->helper (' Download '); Download
UTF-8 and gbk encoding for importing php files to Excel. Php imports to excel-support utf8 and gbk encoding php imports to excel garbled characters because utf8 encoding does not support all utf8 transcoding in the XP system, which perfectly solves
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.