各調査のすべての回答を含む 1 つの csv ファイルをエクスポートする機能があります。すべての調査のすべての回答 (1 つの csv ファイルごとに 1 つの調査) をメノリーにエクスポートし、コンピューターにダウンロードする前に圧縮する機能が 1 つ必要です。
すべてのcsvファイルをサーバーまたはローカルストレージに保存するのではなく、コンピューターにダウンロードする前にメモリに保存して圧縮する必要があります
私はこのコードを使用していました:
function exportAllAnswer() {
allTokenId = getAllTokenId();
foreach(allTokend as $key->$value) {
exportAnswer($value->id, false);
}
$path = 'exportAllCsv';
// we deliver a zip file
header("Content-Type: archive/zip");
// filename for the browser to save the zip file
header("Content-Disposition: attachment; filename=allCsvs.zip");
// get a tmp name for the .zip
$tmp_zip = tempnam ("tmp", "tempname") . ".zip";
//change directory so the zip file doesnt have a tree structure in it.
chdir($path);
// zip the stuff (dir and all in there) into the tmp_zip file
exec('zip '.$tmp_zip.' *');
// deliver the zip file
$fp = fopen("$tmp_zip","r");
echo fpassthru($fp);
// clean up the tmp zip file
unlink($tmp_zip);
// delete folder csv
rmdir($path);
}