我有一个 CSV 文件,其内容是:
jobname1, address11, address12, address13, date
item11, chilled, 2kg
item12, chilled, 20kg
jobname2, address21, address22, address23, date
item21, chilled, 2kg
item22, chilled, 20kg
如何在 PHP 中将其解析为多维数组,item11
并将item12
其附加到jobname1
数组的位置和位置?同样的,我希望item21
anditem22
被追加到jobname2
数组中。的输出var_dump
应该是这样的:
array[0] = jobname1
address11
address12
address13
date
item[0] = item11
chilled
2kg
item[1] = item12
chilled
20kg
array[1] = jobname2
address21
address22
address23
date
item[0] = item21
chilled
2kg
item[1] = item22
chilled
20kg