我有这个 PHP 代码:
//start to process file
//first, move file on to server
echo("Uploading raw file...");
$file1_name=$_FILES['dd_submission_form']['tmp_name'];
move_uploaded_file ( "$file1_name","dd_submission_form.csv") or die("file did not copy<br>");
echo("Done<br/>");
//now open file using sequential access
echo("Opening file...");
$file_handle = fopen("dd_submission_form.csv", "r");
//read in just the first row at the moment to get call plan metadata (column headings)
$first_line=fgetcsv($file_handle);
while (($data = fgetcsv($file_handle, 1000, ',')) !== FALSE)
{
echo $data[0];
}
fclose($file_handle);
print "Import done";
当我上传 CSV 文件时,它只是显示
上传原始文件...完成
打开文件...导入完成
即使我已经回$data[0];
显,这应该显示 CSV 文件中 A 列的数据,但什么也没有
.csv 文件很好地复制到服务器