欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

php解压缩zip文件实例代码_PHP教程

程序员文章站 2022-06-02 21:09:06
...
php
header(Content-type: text/html;charset=utf-8);
error_reporting(E_ALL);
set_time_limit(0);
$zip_filename = "Test.zip";
$zip_filename = key_exists(zip, $_GET) && $_GET[zip]?$_GET[zip]:$zip_filename;
$zip_filepath = str_replace(\, /, dirname(__FILE__)) . / . $zip_filename;
if(!is_file($zip_filepath))
{
die(文件".$zip_filepath."不存在!);
}
$zip = new ZipArchive();
$rs = $zip->open($zip_filepath);
if($rs !== TRUE)
{
die(解压失败!Error Code:. $rs);
}
$zip->extractTo(./);
$zip->close();
echo $zip_filename.解 压成功!;
?>

代码很简单,不过还是研究了好大一会手册
php配置中需要zlib支持
win下就是php_zip.dll

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/486234.htmlTechArticle? php header ( Content-type:text/html;charset=utf-8 ); error_reporting ( E_ALL ); set_time_limit ( 0 ); $zip_filename = " Test.zip " ; $zip_filename = key_exists ( zip , $_GET ) $_...