1

I am reading a large CSV file through fgetcsv(). I want to read the header of the file and the data separately. Below is my code. Any help?

$msg_row = 1;
while (($result = fgetcsv($msg_file,1000, ",")) !== false)
{   
    $msg_data[] = $result;
    $msg_row++;
}
4

1 に答える 1

4

最初に一度呼び出しますか?

$msg_row = 1;
$header = fgetcsv($msg_file, 1000, ",");
while (($result = fgetcsv($msg_file, 1000, ",")) !== false)
{   
    $msg_data[] = $result;
    $msg_row++;
}
于 2013-08-14T16:46:28.130 に答える