Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
The fastest way is to use the command line on the server, for example:
There is also a solution by David Walsh that uses the ZipArchive php class, but php must support this class
If OOP is required, then you can do this based on the option that @vanton suggested
<?php
/**
* @see http://php.net/manual/ru/class.ziparchive.php
*/
class MyZipArchive extends ZipArchive // унаследовал
{
public function addFiles($files = array()) // расширил
{
// ... см. http://davidwalsh.name/create-zip-php
}
}
$zip = new MyZipArchive;
$zip->open($zipTmpAbsFilePath, \ZipArchive::OVERWRITE);
$zip->addFiles(array(
'preload-images/1.jpg',
'rod.jpg',
));
// ещё есть стандартные функции
// $zip->addGlob('path/to/files/*.*');
// $zip->addPattern('*.*', 'path/to/files/')
$zip->close();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question