当我尝试在php中上传csv文件并使用fgetcsv函数导出php中的字段时,它将返回所有结果,而不是以逗号分隔。 我有2个csv文件,但在一个工作,另一个在一个数组中显示所有值 像这样:
Array
(
[0] => Name
[1] => Number
[2] => Tax Center
John12
[3] => 2122561681
[4] => 71 West 19
John13
[5] => 6462102791
[6] => 72 West 19
John14
[7] => 9144190749
[8] => 73 West 19
John15
[9] => 8602867600
[10] => 74 West 19
John16
[11] => 8602435024
[12] => 75 West 19
John17
[13] => 8602429299
[14] => 76 West 19
John18
[15] => 2034838300
[16] => 77 West 19

这是我的代码只能获得第一行csv
if(($handle = fopen($file , "r")) !== FALSE)
{
$fileAdded = true;
$adcon = 0;
while (($data = fgetcsv($handle, 0, ",")) !== FALSE)
{
/*echo '<pre>';
print_r($data);
echo '</pre>';*/
$first = $data;
break;
}
fclose($handle);
}