当前位置:Gxlcms > PHP教程 > 网球王子目录php在线打包_支持子目录

网球王子目录php在线打包_支持子目录

时间:2021-07-01 10:21:17 帮助过:33人阅读

程序使用了php的zip扩展,如果服务器支持,那就可以用了^_^,生成的zip压缩包可以用winrar等来解压的,当然也可以用php来解压。解压的过段时间再发布了。
$button=$_POST['button'];
if($button=="开始打包")
{
$zip = new ZipArchive();
$filename = "./".date("Y-m-d")."_".md5(time())."_jackfeng.zip";
if ($zip->open($filename, ZIPARCHIVE::CREATE)!==TRUE) {
exit("无法创建 <$filename>\n");
}
$files = listdir();
foreach($files as $path)
{
$zip->addFile($path,str_replace("./","",str_replace("\\","/",$path)));
}
echo "压缩完成,共压缩了: " . $zip->numFiles . "个文件\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;
$filepath = $start_dir . '/' . $file;
if ( is_dir($filepath) )
$files = array_merge($files, listdir($filepath));
else
array_push($files, $filepath);
}
closedir($fh);
} else {
$files = false;
}
return $files;
}
?>



在线打包工具






以上就介绍了网球王子目录 php 在线打包_支持子目录,包括了网球王子目录方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

人气教程排行