我正在尝试上传一个 CSV 文件并将其内容放入一个数组中,但我收到了一个错误:(10 后每行的此错误的倍数)
Notice: Undefined offset: 1 in C:\xampp\htdocs\amazon\upload_file.php on line 10
以下是我的代码示例:
if ($handle = file_get_contents($_FILES["file"]["tmp_name"])) {
$data = array();
while ($csv = array(file_get_contents($_FILES["file"]["tmp_name"]))) {
$data = array(
'order-id' => $csv[0],
'order-item-id' => $csv[1], //This is line 10.
'purchase-date' => $csv[2],
'payments-date' => $csv[3],