Hi All
I need to use PHP to extract a zip file as part of a cron job.
I have found this code on the PHP site - http://uk.php.net/manual/en/function.ziparchive-open.php
Not too sure how it works though. I just want to extract a zip file to a directory. Can anyone advise how i would do that?
Thanks in advance
Aaron
I need to use PHP to extract a zip file as part of a cron job.
I have found this code on the PHP site - http://uk.php.net/manual/en/function.ziparchive-open.php
Code:
<?php
$zip = new ZipArchive;
$res = $zip->open('test.zip')
if ($res === TRUE) {
echo 'ok';
$zip->extractTo('test');
$zip->close();
} else {
echo 'failed, code:' . $res;
}
?>
Not too sure how it works though. I just want to extract a zip file to a directory. Can anyone advise how i would do that?
Thanks in advance
Aaron