PHP Import to Excel garbled is because UTF8 encoding in XP system does not support all UTF8 code transcoding once on the perfect solution
Utf-8 Coding CasePHP code
Copy Code code as follows:
Header
In the actual work, many times need to download some of the data on the site into a CSV file, easy to view later.Or use CSV to do some batch upload work.At this point, we need to read and write the CSV.1.CSV Read operation[PHP]View Plaincopy
This article mainly introduces the summary of php csv file code instances. This article provides six sample code for operating CSV files, including reading
This article mainly introduces the summary of php csv file code instances. This article
Today is mainly to write a PHP import CSV file method, in fact, a lot of online search. Can be implemented how to import. But I encountered two problems when I import, one is to write code on Windows when the test has garbled problems, and then
This article mainly introduces the summary of php csv file code instances. This article provides six CSV file code instances, including reading, writing, and reading a specified range. For more information, see
1. read csv data and output it to the
Code:
$file = fopen (' text.csv ', ' R ');while ($data = Fgetcsv ($file)) {//reads a row of CSV each timePrint_r ($data); This is an array, to get every data, access the array subscript can$goods _list[] = $data;}Print_r ($goods _list);echo
Today is mainly to write a PHP import CSV file method, in fact, a lot of online search. Can be implemented how to import. But I encountered two problems when importing, one is to write code on the windows when the test has garbled problem, and then
Export data to Excel or CSV files based on php (with UTF-8 and gbk encoding conversion ). Php imports garbled characters to excel because utf8 encoding does not support all utf8 transcoding in the XP system. it perfectly solves the UTF-8 encoding
Copy Code code as follows:
$file = fopen (' text.csv ', ' R ');
while ($data = Fgetcsv ($file)) {//read one line in CSV every timePrint_r ($data); This is an array, to obtain each data, access to the array subscript can$goods _list[] =
This article describes how to export php code to Excel or CSV (with UTF-8 and gbk encoding conversion, if you need a friend, refer to importing php to excel with garbled characters because utf8 encoding does not support all utf8 encoding and
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.