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 管理、购物车、订单管理、支付宝支付、微信支付、订单退款流程、优惠券等
《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。