Home >Backend Development >PHP Tutorial >Prince of Tennis Directory PHP Online Packaging_Support Subdirectories
The program uses the zip extension of php. If the server supports it, you can use it ^_^. The generated zip package can be decompressed with winrar, etc., and of course it can also be decompressed with php. It will be released after a while after decompression.
$button=$_POST['button'];
if($button=="Start Packing")
{
$zip = new ZipArchive();
$filename = "./".date ("Y-m-d")."_".md5(time())."_jackfeng.zip";
if ($zip->open($filename, ZIPARCHIVE::CREATE)!==TRUE) {
exit( "Cannot create <$filename>n"); t;addFile($path,str_replace("./" ,"",str_replace("\","/",$path)));
}
echo "Compression completed, total compressed: " . $zip->numFiles . "files n";
$zip ->close();
}
Function listdir($start_dir='.') {
$files = array();
if (is_dir($start_dir)) {
$fh = opendir($start_dir);
while (($file = readdir($fh)) !== false) {
if (strcmp($file, '..')==0 || strcmp($file, '..')==0) continue ;
array_push($files, $filepath );
}
closedir($fh);
} else {
$files = false;
}
return $files;
}
?>
Type" c/html; charset= gb2312"> t;
;Online packaging tool
; & lt;/p & gt;
& lt; p & gt; explain: Click to start packaging. After that, it is patient to wait for the packaging to complete. According to the website file, it may take a long time. After the packaging is completed, the compressed package will be stored in the directory of the site to be packaged, named with packing time + random string of variable length + jackfeng.zip, please Log in to ftp and download.