📅  最后修改于: 2022-03-11 14:54:24.449000             🧑  作者: Mango
function parse($filecsv){
$array = $fields = array(); $i = 0;
$handle = @fopen($filecsv, "r");
if ($handle) {
while (($row = fgetcsv($handle, 4096)) !== false) {
if (empty($fields)) {
$fields = $row;
continue;
}
foreach ($row as $k=>$value) {
$array[$i][$fields[$k]] = $value;
}
$i++;
}
if (!feof($handle)) {
return false;
}
fclose($handle);
}
return $array;
}