yxh / php-progressbar
PHP 进度条
1.0.0
2019-10-20 15:04 UTC
This package is auto-updated.
Last update: 2024-09-21 02:17:50 UTC
README
PHP ProgressBar
使用示例
$count = 100; //创建进度条 $progress = ProgressBar::createProgressBar($count); //设置进度条宽度 单位 一格 //$progress->setBarWidth(50); //简洁模式 //$progress->setFormatType(ProgressBar::FORMAT_TYPE_NORMAL); //自定义内容 //$progress->setCustomFormat('%title% %current%/%max% [%bar%] %percent:3s%% 时间:%elapsed%/%estimated% 速度:%speed% 内存:%memory:6s%'); //$progress->setMessage('title','heihei'); for ($i = 0; $i < $count; $i ++){ sleep(1); //下一步 // $progress->next(2); $progress->next(); } //结束 $progress->finish();
需求
- PHP 版本 5.4.0 或更高版本
安装
使用 Composer
获取包
$ composer require yxh/php-progressbar
手动安装
克隆 Git 仓库
$ git clone https://github.com/yaoxiaohang/php-progressbar.git
或下载包 https://github.com/yaoxiaohang/php-progressbar/archive/master.zip