Recommended 10 articles for PHP fgetcsv () functions

Source: Internet
Author: User
Tags php tutorial
PHP's own function fputcsv can be used to print the report (Excel) function. If your report format requirements are not very high, then fputcsv is a good choice. It performs efficiently and does not require a third-party library, which is convenient to use. The above code will generate a CSV file locally, can be opened in Excel, is not very simple. If there is Chinese, after Linux execution, download to the local open will be garbled, then you can use the Iconv function to convert. $list = Array (); $tmp = "Order number, order payment amount, lucky number, user name, user type, period, number generation time, draw time, award logo, Prize, bonus, remark"; $list [] = Iconv (' UTF-8 ', ' gb2312// IGNORE ', $tmp); Outputs the generated CSV directly to the browser header (' Content-disposition:attachment;

1. Use PHP's own functions fputcsv and fgetcsv to export reports and import reports

Summary: PHP comes with a function fputcsv can be printed report (EXCEL) functionality. If your report format requirements are not very high, then fputcsv is a good choice. It performs efficiently and does not require a third-party library, which is convenient to use. First, use FPUTCSV Export report <? PHP $list = Array (" George,john,thomas,usa", " James,adrew, ...

2. PHP reads Excel on the method

Introduction:: This article mainly introduces PHP read Excel method, for PHP tutorial interested students can refer to.

3. Love your Love song Fgetcvs on Linux issues

Description: Love Song:love a love song Fgetcvs on Linux problem: see someone with a character string before a ' or arbitrary half-width symbol, let the bug remove it, but it is too troublesome. Finally, find a function that simulates the FGETCSV function. Copy the code as follows: Function __fgetcsv (& $handle, $length = null, $d = ', ', $e = ' "') {$d = Preg_quote ($d); $e = Preg_

4. Workaround for floccinaucinihilipilification Linux fgetcsv to get an array element as an empty string

Summary: Floccinaucinihilipilification:floccinaucinihilipilification Linux fgetcsv gets an array element as a workaround for an empty string: But on the server, many use Linux servers , the source program uses UTF-8, which makes it easy to create character encoding problems. If the CSV file is only transcoded to UTF-8, so there is no problem on the Windows Server, and on RedHat5.5, in the array obtained with FGETCSV, if the contents of a column are Chinese, the array element corresponding to the column is an empty string, while the English is normal. At this point, you need to set the area:

5. csv file import MySQL PHP processing CSV table file Common methods of operation summary

Introduction: CSV file import mysql:csv file import MySQL PHP processing CSV table File Common operation method Summary: To do online Excel table editing function, Excel xls file format parsing is a problem, This is, after all, a proprietary proprietary format for Microsoft Office. So what to do is use the common CSV (Comma separated value, comma separated values) format. All kinds of Office software can recognize the CSV table, in fact, with a specific delimiter (such as a comma) Separates the table of cells. For PHP, Fgetcsv reads the CSV table, returns an array, and then the foreach output to the HTML <tab

6. fgetcsv function read the CSV file Chinese string problem

Brief: Fgetcsv function reads the CSV file Chinese string problem

7. PHP's Fgetcsv () function

Introduction: PHP's Fgetcsv () function

8. Usage of fgetcsv and compatibility issues with Windows and Linux

Introduction: Usage of fgetcsv and compatibility issues with Windows and Linux

9. Workaround for Fgetcsv obtained when an array element is an empty string

Summary: Workaround for Fgetcsv when an array element is an empty string

The solution to the empty string of array elements obtained by Linux fgetcsv _php Tutorial

Summary: A workaround for an empty string of array elements obtained by Linux Fgetcsv. But on the server, many use Linux server, the source program uses UTF-8, so it is easy to produce character encoding problem. If you just transcode the CSV file to UTF-8, you won't be asked on the Windows Server

"Related question and answer recommendation":

PHP use Fgetcsv upload Chinese appear garbled how to solve?

PHP Splfileobject fgets () and fgetcsv () cannot return to the correct row after seek ().

Php-iconv (): detected an incomplete multibyte character

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.