我的问题是我无法将第二个参数传递给str_getcsv函数。
$rows = array_map('str_getcsv', file($filePath_product_names_t), [";"]);
$header = array_shift($rows);
$csv = [];
foreach($rows as $row) {
$csv[] = array_combine($header, $row);
}
Run Code Online (Sandbox Code Playgroud)
CSV结构
"25";"some text"; "also some Text"
Run Code Online (Sandbox Code Playgroud)
并得到警告:
array_combine():两个参数应具有相等数量的元素
php ×1