PHP code example of xiaosongshu / progress
1. Go to this page and download the library: Download xiaosongshu/progress 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/ */
xiaosongshu / progress example snippets
use Xiaosongshu\Progress\ProgressBar;
/** 创建进度条 */
$bar = new ProgressBar();
/** 总长度 */
$bar->createBar(200);
/** 设置颜色:紫色 (非必选 ,默认白色) */
$bar->setColor('purple');
/** 更新进度条 */
for ($i=1;$i<=10;$i++){
//your code ......
/** 模拟业务耗时 */
sleep(1);
/** 更新进度条 */
$bar->advance(2);
}