我有下載的zip歸檔文件以股代息,我需要提取ZIP壓縮包是我曾嘗試過各種東西的內容目錄,這是最後一次。用php解壓文件?
mkdir("/home/site/public_html/".$db."", 0777);
$url = 'http://wordpress.org/latest.zip';
$path = "/home/site/public_html/".$db."/latest.zip";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
curl_close($ch);
file_put_contents($path, $data);
$zip = new ZipArchive;
$zip->open("/home/site/public_html/".$db."/latest.zip");
$zip->extractTo("/home/site/public_html/".$db."/");
$zip->close();
的zip文件下載只需很好,但它不會提取。有另一種方法可以提取文件嗎?
不確定我關注,是不是'extatcTo()'將'open()'中使用的zip文件的內容解壓到你作爲參數傳遞的路徑中? – 2012-03-04 00:20:39
那麼,理想的情況是,這是應該發生的事情,但事實並非如此。該zip文件下載但不提取。 – user715564 2012-03-04 00:21:32