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 协议》,转载必须注明作者和本文链接
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
讨论数量: 2

是否在找:Artisan 命令行

4个月前 评论
shaolin (楼主) 3个月前

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