Home  >  Article  >  Backend Development  >  PHP关于附件上传解压缩的有关问题

PHP关于附件上传解压缩的有关问题

WBOY
WBOYOriginal
2016-06-13 11:22:31896browse

PHP关于附件上传解压缩的问题
在PHP中 一个压缩包上传,我已经能够解压开来。
现在如何在解压的同时重命名,并且放到另一个目录下啊?
请大神指教。
解压程式
$zip = zip_open("/php/test/test.zip");

if ($zip) {
  while ($zip_entry = zip_read($zip)) {
     $fp = fopen("/php/".zip_entry_name($zip_entry), 'w');
     if (zip_entry_open($zip, $zip_entry, "r")) {
     $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));

     fwrite($fp,'$buf');
     zip_entry_close($zip_entry);
     fclose($fp);
     }
    }
  zip_close($zip);
 }
求在中间加上重命名与另存到一个目录下的功能。。。。。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn