如果没有ZIP分解,只是取得所有目录和各目录下文件名的程序也可以,急切需要,谢谢了 [email protected]

解决方案 »

  1.   

    zip分解是什么意思?unzip?以下是我的程序,希望能帮到你
    //function start
    function handle($path)
     {
           $handle=opendir($path);
           readdir($handle);
           readdir($handle);
           while ($file = readdir($handle))
       {
                  echo "$file<p>";
        if(strstr($file,".shtml"))
        {
          $filename="".$path."/".$file;
          $fd = fopen($filename, "r");
                   while (!feof($fd)) 
          {
                     $buffer = fgetss($fd,255);
          
            $body=$body.$buffer;
          }
                   //$body中存的是所有目录中index.shtml的内容
                   fclose($fd);
          
              
            
        }else if(!strstr($file,"."))
        {
          $pathx=$path."/".$file;
               
       handle($pathx); 
        }else echo "not";       }
           closedir($handle); 
     }//function end
      

  2.   

    谢谢你的回复。但我的意思是想读出ZIP文件里面的内容,不知道PHP是否可以做到这样的功能??
      

  3.   

    这里有个php manual中的例子(有英文的可以下的,www.php.net)
    php有zip支持库的,只读。
    <?php
    $zip = zip_open("/tmp/test2.zip");
    if ($zip) {
        while ($zip_entry = zip_read($zip)) {
            echo "Name:               " . zip_entry_name($zip_entry) . "\n";
            echo "Actual Filesize:    " . zip_entry_filesize($zip_entry) . "\n";
            echo "Compressed Size:    " . zip_entry_compressedsize($zip_entry) . "\n";
            echo "Compression Method: " . zip_entry_compressionmethod($zip_entry) . "\n";        if (zip_entry_open($zip, $zip_entry, "r")) {
                echo "File Contents:\n";
                $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                echo "$buf\n";            zip_entry_close($zip_entry);
            }
            echo "\n";    }    zip_close($zip);}?>