Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
sftp有没有一种方法可以计算通过php下载/上传文件所需的时间和速度,如下所示?
sftp
$sftp->get('filename', 'local/filename'); //gets the file $sftp->size('filename'); //gives the size of the file.
这两个命令获取文件并给出大小..这样我们可以计算速度和时间吗?
当然可以,您拥有所需的所有数据:时间和规模。
$start = time(); $sftp->get('filename', 'local/filename'); //gets the file $size = $sftp->size('filename'); //gives the size of the file. $timeTakenInSeconds = time() - $start; echo sprintf('Bytes/second: %d', $size / $timeTakenInSeconds);