我有一行来自这样的 CSV 文件:
"Item 1","Item 2","Item 3","Item 4","Item 5, Test 6" 重复数千行 项目之间没有空格。
Item 5 和 Test 6 之间的逗号应该在那里。我试图把这条线变成一个数组。
$i=1;
$temp_array = array();
$number = COUNT($array);
while($i <= $number) {
$temp_array[] = explode(",", $array[$i]);
$i++;
}
数组当前输出为“
[1] => Array
(
[0] => "Item 1"
[1] => "Item 2"
[2] => "Item 2"
[3] => "Item 2"
[4] => "Item 5
[5] => Test 6"
)
它应该输出如下:
[1] => Array
(
[0] => "Item 1"
[1] => "Item 2"
[2] => "Item 2"
[3] => "Item 2"
[4] => "Item 5, Test 6"
)