Home > Backend Development > PHP Tutorial > PHP decompress zip file example code_PHP tutorial

PHP decompress zip file example code_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 17:40:14
Original
789 people have browsed it

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(Decompression failed! Error Code:. $rs);
}
$zip->extractTo(./);
$zip->close();
echo $zip_filename.Solution Pressing successful!;
?>

The code is very simple, but I still studied the manual for a long time
zlib support is required in php configuration
Under win, it is 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 ) $_...
Statement of this Website
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template