Prototype Fgetcsv (resource FP, int length [, String delimiter [, String enclosure [, String escape]])
The explanation for enclosure is the character that surrounds the field.
Refer to the http://blog.ifeeline.com/217.html description:
Fields that contain commas, double quotes, or line breaks must be enclosed in quotation marks (special handling is required for only three special values).
The quotation marks inside the field must be preceded by a quotation mark to achieve the transcoding of the quotation marks.
Spaces before and after the delimiter comma may not be trimmed off.
The line break in the element is preserved.
Corresponding to the following example, it will be easier to understand the above explanation.
Field 1 Field 2 Field 3
Goog veture "Vision,good" ABC
For the three fields on the line above, if I want to use FGETSCV () to read it out to the array, the format stored in the CSV file must be qualified.
The contents of the CSV store are in the L two cases:
(1) Situation one, Direct is Goog,veture "Vision,good", ABC
This way you will find that get out is not what you want. Its array output is
Array ([0] = goog [1] = Vetur "evision [2] = = Good" [3] = ABC)
(2) In case two, the content in CSV is GOOG, "veture" "Vision,good" "", ABC
This is based on the above description of the original content has been modified. Plus the Fu Di quotes around the word.
Its array output is what we want.
Array ([0] = goog [1] = veture "Vision,good" [2] = = ABC)
For some of the above instructions, if the field contains a comma, just enclose the field in double quotation marks, without having to precede the comma with double quotes.
In addition, for the last parameter escape, the official explanation is to set the escape character. I do not understand this, I hope someone can provide an example to explain.