你好,我在这里遇到非常不寻常的问题,我的代码在下面
if (isset($_POST['csvSubmit'])) {
$mimes = array('application/vnd.ms-excel','text/plain','text/csv','text/tsv');
if(in_array($_FILES['csv']['type'],$mimes)){
$file = $_FILES['csv']['tmp_name'];
$handle = fopen($file,"r");
$count=0;
while (($data = fgetcsv($handle, 100000, ',')) !== FALSE) {
if($count>0){
mysqli_query($connection,"INSERT INTO `csv_sheet` (`cscid`, `csfname`, `cslname`, `csemail`, `csphone`, `csdep`, `csgender`, `csdob`, `csdate`, `csip`) VALUES ('0', '$data[0]','$data[1]','$data[2]','$data[3]','$data[4]','$data[5]','$data[6]','$data[7]','$data[8]')");
}
$count++;
}
print "File Uploded Successfully";
fclose($handle);
}
else{
die("Sorry, This file type not allowed");
}
}
错误
Notice: Undefined offset: 7 in C:\xampp\htdocs\site\action\csv_import.php on line 45
Notice: Undefined offset: 8 in C:\xampp\htdocs\site\action\csv_import.php on line 45
File Uploded Successfully
虽然文件导入成功但我每次都看到这个错误请建议我在这做什么,也帮助我理解代码