Home >Backend Development >PHP Tutorial >Prince of Tennis Directory PHP Online Packaging_Support Subdirectories

Prince of Tennis Directory PHP Online Packaging_Support Subdirectories

WBOY
WBOYOriginal
2016-07-29 08:38:211133browse

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.

                                                                      
The above introduces the Prince of Tennis directory PHP online packaging_supported subdirectories, including the content of the Prince of Tennis directory. I hope it will be helpful to friends who are interested in PHP tutorials.


Statement:
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