Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

process output

Inhere edited this page Jan 10, 2019 · 1 revision

进度展示

自定义的动态文本输出

使用 Show::dynamicTxt()/$output->dynamicTxt()

show-progress-txt

简单的文本进度输出

使用 Show::progressTxt()/$output->progressTxt()

show-progress-txt

简单的进度条输出

使用 Show::progressBar()/$output->progressBar()

public static function progressBar(int $total, array $opts = [])

示例代码:

$total = 120;
$bar = Show::progressBar($total, [
 'msg' => 'Msg Text',
 'doneChar' => '#'// ♥ しかく ☺ ☻ = # Windows 环境下不要使用特殊字符,否则会乱码
]);
echo "Progress:\n";
$i = 0;
while ($i <= $total) {
 $bar->send(1);// 发送步进长度,通常是 1
 usleep(50000);
 $i++;
}

show-progress-bar

Clone this wiki locally

AltStyle によって変換されたページ (->オリジナル) /