PHP CSV 字符串到数组
我正在尝试将CSV字符串解析为PHP中的数组。CSV 字符串具有以下属性:
Delimiter: ,
Enclosure: "
New line: \r\n
示例内容:
"12345","Computers","Acer","4","Varta","5.93","1","0.04","27-05-2013"
"12346","Computers","Acer","5","Decra","5.94","1","0.04","27-05-2013"
当我尝试像这样解析它时:
$url = "http://www.url-to-feed.com";
$csv = file_get_contents($url);
$data = str_getcsv($csv);
var_dump($data);
最后一个和第一个元素连接在一个字符串中:
[0]=> string(5) "12345"
...
[7]=> string(4) "0.04"
[8]=> string(19) "27-05-2013
"12346""
我该如何解决这个问题?任何帮助将不胜感激。