mirror of
https://github.com/Ne-Lexa/php-zip.git
synced 2025-07-18 22:51:11 +02:00
update README
This commit is contained in:
@@ -78,6 +78,7 @@
|
||||
```php
|
||||
// создание нового архива
|
||||
$zipFile = new \PhpZip\ZipFile();
|
||||
try{
|
||||
$zipFile
|
||||
->addFromString("zip/entry/filename", "Is file content") // добавить запись из строки
|
||||
->addFile("/path/to/file", "data/tofile") // добавить запись из файла
|
||||
@@ -93,6 +94,13 @@ $zipFile
|
||||
->addFromString('dir/file.txt', 'Test file') // добавить новую запись из строки
|
||||
->setPassword('password') // установить пароль на все записи
|
||||
->outputAsAttachment('library.jar'); // вывести в браузер без сохранения в файл
|
||||
}
|
||||
catch(\PhpZip\Exception\ZipException $e){
|
||||
// обработка исключения
|
||||
}
|
||||
finally{
|
||||
$zip->close();
|
||||
}
|
||||
```
|
||||
Другие примеры можно посмотреть в папке `tests/`.
|
||||
|
||||
|
@@ -78,6 +78,7 @@ Latest stable version: [;
|
||||
try{
|
||||
$zipFile
|
||||
->addFromString("zip/entry/filename", "Is file content") // add an entry from the string
|
||||
->addFile("/path/to/file", "data/tofile") // add an entry from the file
|
||||
@@ -93,6 +94,13 @@ $zipFile
|
||||
->addFromString('dir/file.txt', 'Test file') // add a new entry from the string
|
||||
->setPassword('password') // set password for all entries
|
||||
->outputAsAttachment('library.jar'); // output to the browser without saving to a file
|
||||
}
|
||||
catch(\PhpZip\Exception\ZipException $e){
|
||||
// handle exception
|
||||
}
|
||||
finally{
|
||||
$zip->close();
|
||||
}
|
||||
```
|
||||
Other examples can be found in the `tests/` folder
|
||||
|
||||
|
Reference in New Issue
Block a user