PHP code example of zhengbingdong / easy-tools
1. Go to this page and download the library: Download zhengbingdong/easy-tools library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
zhengbingdong / easy-tools example snippets
$zip = new ZipArchive();
$path = $_SERVER['DOCUMENT_ROOT'];
$zipName = $_SERVER['DOCUMENT_ROOT']."/20180826.zip";
if($zip->open($zipName, ZipArchive::CREATE) === TRUE){
addFileToZip($path, $zip); // 调用方法,对要打包的根目录进行操作,并将ZipArchive的对象传递给方法
$zip->close(); // 关闭处理的zip文件
}