我正在从 csv 文件导入数据,所以我使用了该代码
<?php
$path = "Export.csv";
$row = 1;
if (($handle = fopen($path, "r")) !== FALSE) {
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
$row++;
$data_entries[] = $data ;
}
fclose($handle);
}
echo"<pre>";
print_r($data_entries);
echo"</pre>";
?>
我的数组输出就像我的第一个数组显示列名之后所有数组都显示值所以我想根据第一个数组列名插入值
Array
(
[0] => Array
(
[0] => Type
[1] => PinCode
[2] => APN
[3] => County
)
[1] => Array
(
[0] => Auction
[1] => 503082537
[2] => 502-052-002
[3] => United States of America
)
[2] => Array
(
[0] => Auction
[1] => 21596378
[2] => 628-202-038
[3] => Australia
)
)