<?php$total = 100; for ($i = 1; $i <= $total; $i++) { printf("progress: [%-50s] %d%% Done ", str_repeat('#',$i/$total*50), $i/$total*100); sleep(1); } echo " "; echo "Done! ";
在命令行执行比较长时间的任务时,需要实时查看进度。所以需要显示进度条