如何在PHP Shell脚本中显示文件下载进度? [英] How to show file download progress in PHP Shell Scripting?

查看:208
本文介绍了如何在PHP Shell脚本中显示文件下载进度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个php shell脚本下载一个大文件,在shell发生的时候能够看到shell下载的进度有点奢侈,任何人都知道如何实现这一点(或者至少指示我正确的方向!)



谢谢!

解决方案

p>这似乎工作(意外!)

  echowget'$ feedURL'\\\
;
$ execute =wget -O。$ filePath。'$ feedURL'\\\
;
$ systemOutput = shell_exec($ execute);
$ systemOutput = str_replace(\\\
,\\\
\t,$ systemOutput);
echo\t $ systemOutput\\\
;


I have a php shell script that downloads a large file, it would be a bit of a luxury to be able to see the progress of the download in shell while it's happening, anyone have any idea how this can be achieved (or at least point me in the right direction!)

Thanks!

解决方案

This seemed to work (unexpectedly!)

echo "wget '$feedURL'\n";
$execute = "wget -O ".$filePath." '$feedURL'\n";
$systemOutput = shell_exec($execute);
$systemOutput = str_replace( "\n", "\n\t", $systemOutput);
echo "\t$systemOutput\n";

这篇关于如何在PHP Shell脚本中显示文件下载进度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆