0

データを " " で囲む必要がある

出力 csv をフォーマットする必要があります:
"data","data","data"
使用して以下に表示されるコードは、別の質問 here からコピーされました。

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);

}

4

1 に答える 1