exec('zip somedir/somezip.zip somefile.ext');

解决方案 »

  1.   

    服务器不允许使用exec函数怎么办
      

  2.   

    http://www.pconline.com.cn/pcedu/empolder/wz/php/0501/543980.html
      

  3.   

    <?php
    /*  zip 文件解压程序
     *  Written By 唯她
     *  URI: http://www.m121m.net
     * 需要有 php_zip.dll / php_zip.so 库支持
     */$zipFile = "putty-src.zip";$zip = zip_open($zipFile);function mk_dir($dirString,$initDir="./"){
    $dir = explode("/",$dirString);
    if (substr($initDir,-1) != "/" && $initDir != "")
    $initDir .= $initDir."/"; for($i=0;$i<count($dir)-1;$i++){
    $initDir .= $dir[$i] . "/";
    if(!file_exists($initDir) && count($dir) > 1) mkdir($initDir);
    };
    echo "创建目录: $initDir\n";
    }if ($zip) {    while ($zip_entry = zip_read($zip)) {        if (substr(zip_entry_name($zip_entry),-1) != "/" &&  zip_entry_open($zip, $zip_entry, "r")) { if (!file_exists(dirname(zip_entry_name($zip_entry))))
    {
    mk_dir(zip_entry_name($zip_entry));
    }
                $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
    $fout = fopen(zip_entry_name($zip_entry),"w");
    fwrite($fout,$buf);
    echo "解压文件:".zip_entry_name($zip_entry)."\n";

                zip_entry_close($zip_entry);
            } else {
    mk_dir(zip_entry_name($zip_entry));

    }    }    zip_close($zip);}?>
      

  4.   

    如果服务器不是WINDOWS系统怎么办
      

  5.   

    RAR是有版权的吧。ZIP是可以的。如果是虚拟主机,没这个权限,那就什么都不可能了。用tar.gz什么的
      

  6.   

    PHP5不支持zip_open怎么办啊`````
      

  7.   

    to:zhiin(〃稚鹰〃) 
    可以下载PECL
      

  8.   

    netvt(唯她(为了泡老婆,努力学习LISP)) 
    PECL是什么?到哪里下载呢
      

  9.   

    PHP5的很多功能扩展都转到 PECL 项目里了.
    ====
    http://cn.php.net/get/pecl-5.0.4-Win32.zip/from/a/mirrorWhat is PECL?PECL is a repository for PHP Extensions, providing a directory of all known extensions and hosting facilities for downloading and development of PHP extensions.The packaging and distribution system used by PECL is shared with its sister, PEAR.
      

  10.   

    zip,rar都有pecl库的
    服务器不支持就没办法
      

  11.   

    那位提供 php_zip.dll 下载阿 我的php的ext目录里面没有
      

  12.   

    http://www.pconline.com.cn/pcedu/empolder/wz/php/0501/543980.html
    谁用过这个类阿
    怎么我用过几次都不行啊那位有PHP_zip.dll下灾啊 我还是用这个算了
      

  13.   

    http://cn.php.net/get/pecl-5.0.4-Win32.zip/from/a/mirror
      

  14.   

    所有的pecl在php.net官方网站都有