示例#1
0
            $pathData = pathinfo($fileDir . $file);
            $fileName = $pathData['filename'];

            $zip->addFile(file_get_contents($fileDir . $file), $file, filectime($fileDir . $file), NULL, TRUE, Zip::getFileExtAttr($file));
        }
    }
}
*/
// Add a directory, first recursively, then the same directory, but without recursion.
// Naturally this requires you to change the path to ../test to point to a directory of your own.
// $zip->addDirectoryContent("testData/test", "recursiveDir/test");
// $zip->addDirectoryContent("testData/test", "recursiveDir/testFlat", FALSE);

//$zip->sendZip("ZipExample1.zip");
//$zip->sendZip("ZipExample1_€2,000.zip");
$zip->appendZip("../testData/test.zip", "appendedZip1/appendedZip2/../appendedZip3/appendedZip4/");
$zip->appendZip('../testData/test.zip', '/');
$zip->sendZip("ZipExample1_€2,000.zip", "application/zip", "ZipExample1_€2,000_utf8.zip");

// If non-fatal errors occurred during execution, this will append them
//  to the end of the generated file.
// It'll create an invalid Zip file, however chances are that it is invalid
//  already due to the error happening in the first place.
// The idea is that errors will be very easy to spot.
if (!empty($errors)) {
    echo "\n<pre>\n**************\n*** ERRORS ***\n**************\n\n$errors\n</pre>\n";
}

function customError($error_level, $error_message, $error_file, $error_line) {
    global $errors;
    switch ($error_level) {