PHP Zip解压 文件在线解压缩的函数代码

yipeiwu_com6年前PHP代码库
复制代码 代码如下:

/**********************
*@file - path to zip file
*@destination - destination directory for unzipped files
*/
function unzip_file($file, $destination){
// create object
$zip = new ZipArchive() ;
// open archive
if ($zip->open($file) !== TRUE) {
die ('Could not open archive');
}
// extract contents to destination directory
$zip->extractTo($destination);
// close archive
$zip->close();
echo 'Archive extracted to directory';
}

PHP Zip压缩 在线对文件进行压缩的函数

相关文章

php下把数组保存为文件格式的实例应用

我使用过两种办法: 第一种是数组序列化,简单,但是调用时比较麻烦一些;第二种是保存为标准的数组格式,保存时麻烦但是调用时简单。 第一种方法: PHP代码 复制代码 代码如下: $file...

Fatal error: session_start(): Failed to initialize storage module: files问题解决方法

之前编译安装的LNMP环境+phpmyamdin4.02的版本,今天突然出现这个问题:复制代码 代码如下:Fatal error: session_start(): Failed to...

PHP syntax error, unexpected $end 错误的一种原因及解决

Parse error: syntax error, unexpected $end in script.php on line xx 调试了一会后发现产生错误的行是文件中间某行 //$...

PHP生成条形图的方法

PHP生成条形图的方法

本文实例讲述了PHP生成条形图的方法。分享给大家供大家参考。具体实现方法如下: 复制代码 代码如下: <?php   // create an array of...

如何使用Linux的Crontab定时执行PHP脚本的方法

下面介绍Crontab的两种方法。 一、在Crontab中使用PHP执行脚本 就像在Crontab中调用普通的shell脚本一样(具体Crontab用法),使用PHP程序来调用PHP脚本...