我有以下代码,
function Warrantyform($to, $subject, $template, $replaceArray)
{
$return = "";
$str = valString($template);
//die(var_dump($replaceArray));
CallDatabase("insert into sales_formsholder
(iformtype, cto, csubject, cmsg, chtmlmsg)
values ( 1 ,'" . $to . "', '" . $subject . "', '" . $str . "', '')");
//$handle = fopen($_SERVER["DOCUMENT_ROOT"]. "/cron/" . date(dMY) . ".csv");
$aList = array();
foreach ($replaceArray as $k => $v) {
$aList[] = (string)$v ;
}
$aList[] = date("d.m.Y h:i:s");
$aCsvLine = array(
$aList
);
$fp = fopen($_SERVER['DOCUMENT_ROOT'] .
"/cron/register_warranty_" . date("dMY") . ".csv", 'a');
//die(var_dump($fp));
foreach ($aCsvLine as $fields) {
fputcsv($fp, $fields);
}
fclose($fp);
}
我期待得到这样的输出,
"column 1", "column 2", "column 3", "column 4", "column 5"
但我得到的更像是,
"column 1", column 2, column 3, "column 4", "column 5"
我需要正确封闭 CSV 中的每个条目,为什么没有发生这种情况?