いくつかの画像を圧縮してユーザーに動的に表示する古いスクリプトを編集しています。
ほとんどすべてのコードを書き直しましたが、zipファイルの内容を出力する方法が見つかりません。サーバーに書き込むことは非常に望ましくありません。
次のコマンドでファイルを作成します。
$z = new ZipArchive();
次のコンテンツを追加できます:
$z->addFromString("filename",$string);
そして、私はそれを動的に提示したいと思います:
header("Content-Type: application/zip;");
header("Content-Disposition: attachment; filename=file.zip;");
// I need a function to read the contents of the zipfile here. Something like:
echo $z->filecontent();
これに使用する関数がわかりません。