2011-09-22 86 views
2

我認爲ZipArchive::filename將代表實際壓縮文件的路徑,但對於我打開的每個壓縮文件ZipArchive::open(),ZipArchive::filename都給了我一個空字符串。ZipArchive :: filename,它應該如何工作?

例子:

$zip = new ZipArchive(); 
$zip->open('/some/path/to/zipfile.zip'); 
var_dump($zip->filename); 

// expecting: 
string(25) "/some/path/to/zipfile.zip" 

// but getting: 
string(0) "" 

我誤解ZipArchive::filename,或將其錯誤吧?

在Apache,Windows XP上使用PHP 5.2.6。

+0

你想打開壓縮和解壓的內容是什麼? –

+0

@Michael:我將擴展'ZipArchive'來表示備份文件,我只接受由數字(表示日期)組成的文件名。我將從文件中提取文件並將文件歸檔到檔案中。我想利用'ZipArchive :: filename'來給我文件的基本名稱。 –

+0

它贏得了php5.3.1的罰款。你可以var_dump()返回:: open()來查看是否有一些錯誤? [錯誤代碼](http://ar.php.net/manual/en/function.ziparchive-open.php#87423) – Einacio

回答

相關問題