I've three string $a, $b, $c
I want to output the content in this three variables into a.txt
, b.txt
& c.txt
and zipped into a file for user to download.
Is it possible to do so without using a temp file?
You can do this with a combination of PHP's ability to create files in memory using fopen(‘php://memory’, ‘wb+’)
instead or writing them to disk, and a third-party class called CreateZIP which creates zip files in memory and lets the user download them, You can see details on how to create the text files, as well as the zip file, by following these links:
http://aaronbonner.io/post/840054542/using-memory-as-a-file-in-php-5-1