download_class.php
873 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/**
 * Tiny - A PHP Framework For Web Artisans
 * @author Tiny <tinylofty@gmail.com>
 * @copyright Copyright(c) 2010-2014 http://www.tinyrise.com All rights reserved
 * @version 1.0
 */
/**
 * 下载类
 * 
 * @author Tiny
 * @class Download
 */
class Download{
    /**
     * 压缩方法
     * 
     * @access public
     * @param mixed $files
     * @param mixed $zipfile
     * @return mixed
     */
	public function zip($files,$zipfile){
		if(class_exists('ZipArchive'))
		{
			$zip = new ZipArchive();
			$zip->open($zipfile,ZIPARCHIVE::CREATE);
			foreach($files as $file)
			{
				$zip->addFile($file,basename($file));
			}
			$zip->close();
			return true;
		}
		else
		{
			return false;
		}
	}
    /**
     * 下载
     * 
     * @access public
     * @return mixed
     */
	public function down(){
		
	}
}