noganno
6/11/2015 - 9:37 AM

создание архива файлов на сайте.php

<?php
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);

$pathdir= $_SERVER['DOCUMENT_ROOT']. '/';

include_once('pclzip.lib.php'); 


$date = date('Y-m-d_h-i-s'); 
$archive = new PclZip('archive.zip'); 

$v_dir = getcwd(); // or dirname(__FILE__); 
$v_remove = $v_dir; 

  echo $v_remove; 
  // To support windows and the C: root you need to add the 
  // following 3 lines, should be ignored on linux 
  if (substr($v_dir, 1,1) == ':') { 
    $v_remove = substr($v_dir, 2); 
  } 


  $v_list = $archive->create($v_dir, $p_add_dir="", $p_remove_dir=""); 


    if ($v_list == 0) { 
    die("Error : ".$archive->errorInfo(true)); 
  }