echo "Progress : "; // 5 characters of padding at the end
for ($i=0 ; $i<=100 ; $i++) {
    echo "\033[5D"; // Move 5 characters backward
    echo str_pad($i, 3, ' ', STR_PAD_LEFT) . " %"; // Output is always5 characters long
    sleep(1); // wait for a while, so we see the animation
}

 

posted on 2020-06-06 16:01  头皮发麻  阅读(793)  评论(0编辑  收藏  举报