From eca42d118e439dc0f3796650e8a68992d513f8ee Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Mon, 3 Sep 2018 07:12:40 -0400 Subject: add examples/{10,11,12,13}*php, add examples/*zip to .gitignore --- examples/13-add_file_times.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 examples/13-add_file_times.php (limited to 'examples/13-add_file_times.php') diff --git a/examples/13-add_file_times.php b/examples/13-add_file_times.php new file mode 100644 index 0000000..bf226b3 --- /dev/null +++ b/examples/13-add_file_times.php @@ -0,0 +1,32 @@ + new FileWriter(), +]; + +# create archive in this directory with a comment +ZipStream::send($zip_path, function(ZipStream &$zip) { + # get current time + $time = time(); + + # add "hello.txt" to output with a time of 2 hours ago + $zip->add_file('hello.txt', 'hello world!', [ + 'time' => $time - (2 * 3600), + ]); + + # add "hola.txt" to output with a time of 2 hours in the future + $zip->add_file('hola.txt', 'hola!!', [ + 'time' => $time + (2 * 3600), + ]); +}, $zip_args); -- cgit v1.2.3