【发布时间】:2017-03-17 12:30:42
【问题描述】:
我正在将 Lumen 框架用于一个辅助项目,并创建了一个工匠命令,该命令将一个小表写入终端。我遇到的麻烦是清除终端并重新绘制表格。
public function fire()
{
$scraper = new scraper();
$scores = $scraper->scrape();
$i = 1;
while($i = 1) {
$table = new Table($this->getOutput());
$table->setHeaders(array('', 'Score', 'Status'));
foreach($scores as $game) {
$table->addRow([$game->team1['name'], $game->team1['score'], new TableCell($game->gameStatus, array('rowspan' => 2))]);
$table->addRow([$game->team2['name'], $game->team2['score']]);
$table->addRow([new TableSeparator(), new TableSeparator(), new TableSeparator()]);
}
$table->render();
sleep(5);
// Somehow clear the terminal
}
}
有人有什么想法吗?
【问题讨论】:
-
您能否详细说明“遇到麻烦”?
-
@JoeC “遇到麻烦”,因为我不确定如何完成清除控制台。
标签: php laravel command-line terminal lumen