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.
*/www.bkjia.com
1 2
http://www.bkjia.com/PHPjc/444846.html
true