laravel命令行增加进度条

set_time_limit(0);
ini_set('memory_limit', '2048');
$date = date("Y-m-d H:i:s");
$this->info("开始-执行导出脚本 " . $date);
$this->warn("此操作可能需要一些时间……");
print "\n";

$intStepSize = 10;
$intCount = 100000;
$output = new \Symfony\Component\Console\Output\ConsoleOutput();
$progressBar = new \Symfony\Component\Console\Helper\ProgressBar($output, $intCount);
$progressBar->setFormat("已用时间:%elapsed:6s%/预计完成时间:%estimated:-6s% 内存消耗: %memory:6s%\n%current%/%max% [%bar%] %percent:3s%%");
for ($i = 1; $i <= $intCount; $i += $intStepSize) {
 usleep(100);
  $progressBar->advance($intStepSize);
}
$progressBar->finish();

laravel命令行增加进度条

laravel命令行增加进度条

偷懒没有做成动图

本作品采用《CC 协议》,转载必须注明作者和本文链接
《L05 电商实战》
从零开发一个电商项目,功能包括电商后台、商品 & SKU 管理、购物车、订单管理、支付宝支付、微信支付、订单退款流程、优惠券等
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
讨论数量: 1

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!