本文整理匯總了PHP中Zip::addStreamData方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zip::addStreamData方法的具體用法?PHP Zip::addStreamData怎麽用?PHP Zip::addStreamData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zip
的用法示例。
在下文中一共展示了Zip::addStreamData方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: customError
if (strpos($file, ".php") !== false) {
$pathData = pathinfo($fileDir . $file);
$fileName = $pathData['filename'];
$zip->addFile(file_get_contents($fileDir . $file), $file, filectime($fileDir . $file), NULL, TRUE, Zip::getFileExtAttr($file));
}
}
}
// Uses my Lipsum generator from https://github.com/Grandt/PHPLipsumGenerator
if(file_exists('./LipsumGenerator.php')) {
require_once './LipsumGenerator.php';
$lg = new com\grandt\php\LipsumGenerator();
$zip->openStream("big one3.txt");
for ($i = 1 ; $i <= 20 ; $i++) {
$zip->addStreamData("Chapter $i\r\n\r\n" . $lg->generate(300, 2500) . "\r\n");
}
$zip->closeStream();
}
$zip->sendZip("ZipExample3.zip", "application/zip", "ZipExample3.zip");
// If non-fatal errors occured 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\n**************\n*** ERRORS ***\n**************\n\n$errors";
}
function customError($error_level, $error_message, $error_file, $error_line) {