Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 从Laravel命令中清除控制台_Php_Laravel_Command Line_Terminal_Lumen - Fatal编程技术网

Php 从Laravel命令中清除控制台

Php 从Laravel命令中清除控制台,php,laravel,command-line,terminal,lumen,Php,Laravel,Command Line,Terminal,Lumen,我将Lumen框架用于一个侧面项目,并创建了一个artisan命令,将一个小表写入终端。我遇到的问题是,清理终端并重新绘制表格 public function fire() { $scraper = new scraper(); $scores = $scraper->scrape(); $i = 1; while($i = 1) { $table = new Table($this->getOutput()); $t

我将Lumen框架用于一个侧面项目,并创建了一个artisan命令,将一个小表写入终端。我遇到的问题是,清理终端并重新绘制表格

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 
    }
}

有人有什么想法吗?

一个肮脏的修补程序应该是这样的:

if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
    system('cls');
} else {
    system('clear');
}
你能详细解释一下“有麻烦吗”?@JoeC“有麻烦”就像我不知道如何完成清理控制台一样。