I've been trying to figure what the length parameter in fgetcsv mean? THe documentation states that it is:

Must be greater than the longest line (in characters) to be found in the CSV file (allowing for trailing line-end characters). It became optional in PHP 5. Omitting this parameter (or setting it to 0 in PHP 5.0.4 and later) the maximum line length is not limited, which is slightly slower.

That made no effort to explain the specific purpose of the length resource. It just gives information on requirements.

Can someone please tell me what this does. Google was no help. I think its the key to allowing me to read only the first row of my csv file but I'm not sure. I tried testing it with a value of 1 but it returned a full array of rows still.

有帮助吗?

解决方案

It is the limit of length of every line you read, if you set length to 1000, mean you could only read 1000 byte data for each line.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top