PHP code example of iphper / progress-bar
1. Go to this page and download the library: Download iphper/progress-bar library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
iphper / progress-bar example snippets
php
essBar\ProgressBar;
// 简单示例
$total = 1000;
// 测试
$pb = new ProgressBar($total);
for($i = 0; $i < $total; ++$i) {
$pb->add();
usleep(10000);
}
// 重置
$pb->reset();
// 修改Output
$output = $pb->getStdOutput();// 或 \ProgressBar\Output\OutputFactory::make();
$output->setUnfinishedChar('-');
$output->setDoneChar('=');
$pb->setStdOutput($output);
// 测试
$step = 5;
for($i = 0; $i < $total; $i += $step) {
$pb->add($step); // 传入步长
usleep(10000);
}