我需要将我的数据包含在“”中已经尝试了几件事,但我只是弄乱了我的数据
我需要格式化输出 csv:
“数据”、“数据”、“数据”
我使用并显示在下面的代码是从此处的另一个问题复制而来的。
if (($handle = fopen('DIRTY_'.$val['spider'].'.csv', 'r')) !== false) {
// read each line into an array
while (($data = fgetcsv($handle, 8192, ",")) !== false) {
// build a "line" from the parsed data
$line = join("," , $data );
// if the line has been seen, skip it
if (isset($lines[$line])) continue;
// save the line
$lines[$line] = true;
}
fclose($handle);
}
$contents = '';
foreach ($lines as $line => $bool) $contents .= $line . "\r\n";
file_put_contents($val['spider'].".csv", $contents);
}