10/10/2018, 11:23

CHo tui xin code Unzip PHP

Ai đó cho tui xin code unzop PHP trên hót nha, Cpanel trên hót ko support. Thanks.
tumickey viết 13:26 ngày 10/10/2018
http://www.phpclasses.org/browse/file/16043.html
aarone2003 viết 13:35 ngày 10/10/2018
unzip.php
PHP Code:
 <?php
  
require_once('pclzip.lib.php');
  
$archive = new PclZip('example.zip');
  if ((
$v_result_list $archive->extract()) == 0) {
    die(
"Error : ".$archive->errorInfo(true));
  }
  echo 
"<pre>";
  
var_dump($v_result_list);
  echo 
"</pre>";
?>
giải nén file pclzip.lib.rar ra đc file pclzip.lib.php ...up lên cùng 1 folder .. và enjoy ^^

[ unzip file nao thi` change file name trong file unzip.php nha ] ^^
Nagas! viết 13:33 ngày 10/10/2018
sao mình download không được vậy nhỉ!
bébi viết 13:28 ngày 10/10/2018
Uh, nhấp vô cái attackment thấy trang trắng.
__________________
[img]http://************.com/ads/client-144718.gif[/img]
offur.com viết 13:31 ngày 10/10/2018
http://offur.com/zip -> zip.php, down trực tiếp
xcode viết 13:27 ngày 10/10/2018
tham khảo cái này nè http://php.net/manual/en/ref.zip.php
nguyenhoatq viết 13:38 ngày 10/10/2018
PHP Code:
function __unzip($zipfile$dir =''){
        if (
phpversion()>5){
            
$this->__unzip5($zipfile$dir);
        } else {
            
$this->__unzip4($zipfile$dir);
        }
    }
    
    function 
__unzip5($zipfile$dir=''){
        
$zip = new ZipArchive;
        if (
$zip->open($zipfile) === TRUE) {
           
$zip->extractTo($dir);
           
$zip->close();
          return 
true;
        } else {
            
$this->__alert('Không mở file được');
           return 
false;
        }
    }
    
    function 
__unzip4($zipfile$dir ='')
    {
        
$zip zip_open($zipfile);
        while (
$zip_entry zip_read($zip)) {
            
zip_entry_open($zip$zip_entry);
            if (
substr(zip_entry_name($zip_entry), -1) == '/') {
                
$zdir substr(zip_entry_name($zip_entry), 0, -1);
                if (
file_exists($zdir)) {
                    
trigger_error('Directory "<b>' $zdir '</b>" exists'E_USER_ERROR);
                    return 
false;
                }
                
mkdir($zdir);
            } else {
                
$name zip_entry_name($zip_entry);
                if (
file_exists($name)) {
                    
trigger_error('File "<b>' $name '</b>" exists'E_USER_ERROR);
                    return 
false;
                }
                
$fopen fopen($name"w");
                if (
zip_entry_filesize($zip_entry)) { 
                    
fwrite($fopenzip_entry_read($zip_entryzip_entry_filesize($zip_entry)), zip_entry_filesize($zip_entry));
                }
            }
            
zip_entry_close($zip_entry);
        }
        
zip_close($zip);
        return 
true;
    } 
Cái này ko biết có giúp được gì bạn ko ?
Mà muốn unzip được thì safe_mode = On thì phải.
NoviE viết 13:31 ngày 10/10/2018
Thanks bác! đang cần code này
Bài liên quan
0