在说什么之前。我已经在寻找这个问题的解决方案。我现在正试着弄清楚这件事。
我目前正在尝试通过每次下载文件get时回显来显示ftp下载的进度。
这是我的代码的一部分:
<?php
header('Content-type: text/html; charset=utf-8');
header('Cache-Control: no-cache, must-revalidate');
header('X-Accel-Buffering: no');
// ftp connection stuff goes here
$string_length = 4096;
for ($i=0; $i < $filesLength; $i++) {
if (ftp_get($ftp_conn, './downloads/'.$files[$i]['local'], $files[$i]['server'], FTP_ASCII)) {
echo 'File: '.$files[$i]['local'].' saved.<br>';
// $string = str_repeat('.', $string_length);
// echo '<div style="display:none;">'.$string . '</div>';
ob_flush();
flush();
} else {
echo "Error";
}
}
有2行注释行,如果我取消注释所有内容,它就会正常工作。
我应该怎么做才能让它工作呢?
发布于 2017-02-07 18:41:00
我想我还没有找到一个合适的解决方案。
我最终使用了一个4kb的字符串来触发刷新。
这是可行的,但并不像预期的那样。
https://stackoverflow.com/questions/41985816
复制相似问题