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();
偷懒没有做成动图
本作品采用《CC 协议》,转载必须注明作者和本文链接
是否在找:Artisan 命令行