Home > Backend Development > PHP Tutorial > PHP file online compression program class (1/2)_PHP tutorial

PHP file online compression program class (1/2)_PHP tutorial

WBOY
Release: 2016-07-20 11:08:59
Original
943 people have browsed it

PHP file online compression program provides a perfect PHP file online compression program. The principle is very simple, it saves the file in binary form. I have used the kernel program using rar before. This is PHP's own compression function.

PHP tutorial file online compression program class
Provides a super perfect online compression program for PHP files. The principle is very simple, just save the file in binary form. I have used the kernel program using rar before. This is PHP's own With compression function.
*/

set_time_limit(0);
class phpzip{

var $file_count = 0;
var $datastr_len = 0;
var $dirstr_len = 0;
var $filedata = ''; //This variable is only accessed by programs outside the class
var $gzfilename;
var $fp;
var $dirstr='';

/*
Returns the modification time format of the file.
Only called for internal functions of this class.
*/
function unix2dostime($unixtime = 0) {
$timearray = ($unixtime == 0) ? getdate() : getdate($unixtime);

if ($timearray['year'] < 1980) {
$timearray['year'] = 1980;
$timearray['mon'] = 1;
$timearray['mday'] = 1;
$timearray['hours'] = 0;
$timearray['minutes' ] = 0;
             $timearray['seconds'] = 0; ['mon'] << 21) | ($timearray['mday'] << 16) | minutes'] << 5) | ($timearray['seconds'] >> 1);
}

/*

Initialize the file, create the file directory,
and return the file Write permission.
*/
function startfile($path = 'faisun.zip'){
$this->gzfilename=$path;
$mypathdir=array();
do{
$mypathdir[] = $path = dirname($path);
}while($path != '.');
@end($mypathdir);
do {
$path = @current($mypathdir);
@mkdir($path);
}while(@prev($mypathdir));

if($this-> ;fp=@fopen($this->gzfilename,"w")){
                                                                                                                                                                                                                                    into the zip package.
*/



1 2




http://www.bkjia.com/PHPjc/444846.html

www.bkjia.com

true

http: //www.bkjia.com/PHPjc/444846.html

TechArticlephp file online compression program class provides a super perfect php file online compression program. The principle is very simple. Saved in binary form, I have used a kernel program using rar before, this...
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template