Home > Backend Development > PHP Tutorial > PHP solves the function of deleting zip

PHP solves the function of deleting zip

WBOY
Release: 2016-07-29 08:58:58
Original
1758 people have browsed it

$zip = new ZipArchive;

if($zip->open('Resources.zip', ZipArchive::OVERWRITE)=== TRUE)

{

//Equivalent to deleting the entire compressed package file, and then add a picture to them

$zip->addFile('test.png');

//Updating the compressed package is equivalent to re-compressing

addFileToZip('Resources/', $zip); //Call the method, operate on the root directory to be packaged, and pass the ZipArchive object to the method

$zip->close(); //Close the processed zip file

// echo 'ok';

} else {

echo "

}

Note: Because it cannot be deleted, it is achieved by importing an image first.

The above introduces the function of PHP to solve the problem of deleting zip, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template