我正在使用此代码来处理上传的 csv 文件。如何将其转换为 Json 并循环显示在用户的屏幕上?
if (($handle = fopen('upload/'.$current.$_FILES["file"]["name"]. '', "r")) !== FALSE) {
while (($row_array = fgetcsv($handle, 1024, ","))) {
foreach ($row_array as $key => $val) {
$row_array[$key] = trim(str_replace('"', '', $val));
}
$complete[] = $row_array;
}
fclose($handle);
}