使用下面的脚本加入多个CSV文件并编写文件。
如何编写相同的内容并使用不同的文件名创建两个不同的文件?
SELECT DISTINCT
MSysObjects.Name, MSysQueries.Name1, MSysQueries.Name2, MSysQueries.Expression
FROM
MSysQueries
INNER JOIN
MSysObjects ON MSysQueries.ObjectId = MSysObjects.Id;
答案 0 :(得分:1)
$fp1 = fopen("../newfile1.csv", "w");//output file set here
$fp2 = fopen("../newfile2.csv", "w");//output file set here
foreach ($csvarray as $fields) {
fputcsv($fp1, $fields);
fputcsv($fp2, $fields);
}
答案 1 :(得分:0)
我意识到我可以做到这一点..在行之后..
// Need to create another file with the same contents here!!
$fq = fopen("../another_new_file.csv", "w");
foreach ($csvarray as $fields) {
fputcsv($fq, $fields);
}