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 协议》,转载必须注明作者和本文链接
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
讨论数量: 2

是否在找:Artisan 命令行

1个月前 评论
shaolin (楼主) 1个月前

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