开发者

PHP How to retrieve first line of a .CSV as a string?

开发者 https://www.devze.com 2023-01-25 01:24 出处:网络
How do I retrieve the first line of a .CSV file as a string? This current method I am using is failing to return the first line, but is instead returning the second line:

How do I retrieve the first line of a .CSV file as a string?

This current method I am using is failing to return the first line, but is instead returning the second line:

$content 开发者_高级运维= file($filepath);
echo $content[0];


fgets() can be used to read a single line from a file.


This function will work better for you: fgetcsv()

But on a large files and if you need the performance use this function: http://ca2.php.net/manual/en/function.fgets.php

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号