用逗号将行添加到csv

时间:2019-02-20 10:42:20

标签: php csv

我在CSV文件(products.csv)上有此行

"PRODUCT ID","PRICE","FILE","EMAIL TEMPLATE","EXPIRATION IN SECONDS","EMAIL TITLE"
"Ultimate Reminder","1.88","UltimateReminder.apk","01.html",10000,"Compra completada - UltimateReminder.apk"

我需要一个php代码,该代码应在CSV文件中添加行,就像第二行已经在CSV文件中一样。

我有此代码,但不要添加

<?php
$list = array
(
'Product 2,20.30,Product2.apk,01.html,1000,Payment Completed - Product2.apk'
);

$file = fopen('productos.csv','a');  // 'a' for append to file - created if doesn't exit

foreach ($list as $line)
  {
  fputcsv($file,explode('",',$line));
  }

fclose($file); 
?>

提示:数字1000,必须不带

问题是:如何按照向csv添加行?

0 个答案:

没有答案