IamはPHP5.2xと「ZipArchive」に夢中になっています。次のコードはエラーをスローせず、すべての部分がtrueを返しますが、ZIPファイルは作成されません。
誰かが見ないエラーを見ることができますか?
if ($handle = opendir($directory)) {
$zip = new ZipArchive();
$filename = time() . '.zip';
$path = APPLICATION_PATH . '/../download/';
$status = $zip->open($path . $filename, ZIPARCHIVE::CREATE);
if ($status !== true) {
$this->log->err('Cant create zipArchive!');
return false;
}
while (false !== ($file = readdir($handle))) {
if (!is_dir($file)) {
if (is_readable($file)) {
if (!$zip->addFile($file)) {
$this->log->err('Cant add File to archive: ' . $file);
}
} else {
$this->log->debug('Added file to archive: ' . $file);
}
}
}
closedir($handle);
if (!$zip->close()) {
$error = $zip->getStatusString();
$this->log->err($error);
$this->log->err('Cant create archive..');
}
}