php如何在线解压rar,gz,zip文件
请高手指点,因为我要用ftp链接到远程服务器去读取日志文件,因为很多日志文件都是压缩形式的,所以我需要在线解压文件之后再进行读取,然后再删除解压出来的文件,请高手指点
谢谢

解决方案 »

  1.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【victor0910】截止到2008-06-27 15:22:07的历史汇总数据(不包括此帖):
    发帖数:7                  发帖分:140                
    结贴数:1                  结贴分:20                 
    未结数:6                  未结分:120                
    结贴率:14.29 %            结分率:14.29 %            
      

  2.   

    有老紫竹的马甲提醒.蛮好. 至少可以看得出提问者如何对待别人劳动的.这类问题就PASS了.
      

  3.   

    gz zip有扩展 rar 自己想办法把
      

  4.   

    以下来自网络,未经测试<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>PHP解压RAR文件</title>
    <link rel="stylesheet" type="text/css" href="style.css">
    </head>
    <script language="javascript">
    function chkinput(form){
    if(form.sourcefile.value==""){
    alert("请选择要解压的文件地址!");
    form.sourcefile.select();
    return(false);
    }
    if(form.objfile.value==""){
    alert("请输入解压文件存储地址!");
    form.objfile.select();
    return(false);
    }
    return(true);
    }</script>
    <body>
    <table width="300" height="166" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
    <td background="images/back.gif"><table width="300" height="166" border="0" cellpadding="0" cellspacing="0">
    <form name="form1" method="post" action="index.php" onsubmit="return chkinput(this)">
    <tr>
    <td height="50" colspan="2"> </td>
    </tr>
    <tr>
    <td width="100" height="25"><div align="right">ZIP文件地址:</div></td>
    <td width="200"> <input type="file" name="sourcefile" size="18" class="inputcss"> </td>
    </tr>
    <tr>
    <td height="25"><div align="right">解压后存储目录:</div></td>
    <td height="25"> <input type="text" name="objfile" size="18" class="inputcss">
    (c:\目录名)</td>
    </tr>
    <tr>
    <td height="66" colspan="2"><div align="center"><input type="submit" name="submit" value="解压" class="buttoncss"></div></td>
    </tr>
    </form> 
    </table></td>
    </tr>
    </table>
    <?php
    if($_POST[submit]!=""){
    $sourcefile=$_POST[sourcefile];
    $objfile=$_POST[objfile];
    $obj=new com("wscript.shell");
    $obj->run("WinRAR x-r-o ".$sourcefile." ".$objfile."",1,true);
    echo "<script>alert('文件解压完成!');</script>";
    }
    ?></body>
    </html>
      

  5.   

    找个压缩/解压的php类
    或者,调用系统命令,比如:
    exec(tar cvzf '源文件' '目标文件' $return1,$return2)$return1和$return2,系统命令执行的情况的返回值,可以判断执行效果。$return1返回最后一句,$return2返回所有一个数组
      

  6.   

    以前做过,VBA下调用shell调用rar.exe批量解压,发果PHP没有相关解压程序,只能用这个了
      

  7.   

    winrar 有个rar.exe命令行工具 php exec 外部执行一下.具体的可以查下资料.不过不结贴的话,以后想问问题就难了.
      

  8.   

    搜索faisun在线压缩/解压ZIP文件程序 v1.0可有解解压:
    搜索:faisun_unzip.php压缩:
    搜索:faisun_zip.php