ZipArchive::registerProgressCallback
(PHP >= 8.0.0, PECL zip >= 1.17.0)
ZipArchive::registerProgressCallback — Register a callback to provide updates during archive close.
说明
Register a callback
function to provide updates during archive close.
参数
rate
-
Change between each call of the callback (from 0.0 to 1.0).
callback
-
This function will receive the current
state
as a float (from 0.0 to 1.0).
示例
This example creates a ZIP file archive php.zip and show progression.
示例 #1 Archive a file
$zip = new ZipArchive();
if ($zip->open('php.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE)) {
$zip->addFile(PHP_BINARY, 'php');
$zip->registerProgressCallback(0.05, function ($r) {
printf("%d%%\n", $r * 100);
});
$zip->close();
}
注释
注意:
This function is only available if built against libzip ≥ 1.3.0.
参见
- ZipArchive::registerCancelCallback() - Register a callback to allow cancellation during archive close.
+添加备注
用户贡献的备注
此页面尚无用户贡献的备注。
备份地址:http://www.lvesu.com/blog/php/ziparchive.registerprogresscallback.php