php - Creating ZIP archive on fly from PHPExcel Objects -
i'm developing small api in php , need create zip archive on fly contents (files) created on fly phpexcel library, know how it?
it seems can this:
<?php $zip = new ziparchive; $res = $zip->open('test.zip', ziparchive::create); if ($res === true) { $zip->addfromstring('test.txt', 'file content goes here'); $zip->close(); echo 'ok'; } else { echo 'failed'; } ?>
so have content phpexcel in string use addfromstring
method.
for more information have here: http://php.net/manual/en/ziparchive.addfromstring.php
Comments
Post a Comment