Introduction: This is a detailed page of PHP using Zip, introduced and php,php, zip PHP with the use of zip-related knowledge, skills, experience, and some PHP source code.
class= ' pingjiaf ' frameborder= ' 0 ' src= ' http://biancheng.dnbcw.info/pingjia.php?id=350525 ' scrolling= ' no ' > in PHP, You can use PHP's own zip function to package and decompress certain files, which is more than other languages
are very convenient, the method summary is as follows:
1 Open the extension extension in php.ini, enable (PHP 5.2 has this feature later)
extension= Php_zip.dll
2 compressing files
Open ($file, $ow? Ziparchive::overwrite:ziparchive::create) ===true) { //Add a file $zip->addfile ("C:\\master.txt"); A1.txt will be kept pressurized to A2.txt $zip->addfile ("C:\\a1.txt", "C:\\a2.txt"); $zip->addfile ("C:\\a3.txt"); Close $zip->close (); }?>
3 Decompression
$zip = new Ziparchive (); Open Master.zip if ($zip->open ("master.zip") = = = TRUE) { //unzipped path $zip->extractto ("/path/to/ folder/"); $zip->close (); }//Unzip only one file //Open Master.zip for extracting single files if ($zip->open ("master.zip") = = = = TRUE) { //Wil L extract only fonts.css from Master.zip to given path. $zip->extractto ("/path/to/folder/", "fonts.css"); $zip->close (); }//Unzip multiple files if ($zip->open ("master.zip") = = = TRUE) { $files = array ("Fonts.css", "master.css"); $zip->extractto ("/path/to/folder/", $files); $zip->close (); }
Love EE focus on Java Michael Jackson Video station JSON online tool
Http://biancheng.dnbcw.info/php/350525.html Pageno:3