php - PHP sftp - 我可以获得下载/上传速度吗?
问题描述
是否可以使用标准 PHP 工具 (ssh2_sftp) 获取有关下载和上传速度的信息?
解决方案
$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);
推荐阅读
- powershell - 用于打印所有子文件夹的 PowerShell 脚本
- javascript - Angular 5通过锚点下载文档在IE中不起作用
- javascript - 如何根据另一个输入字段使输入字段只读?
- c# - 找不到与兼容的“Microsoft.Azure.WebJobs”版本
- python - xlsxwriter worksheet.write_blank 适用于范围
- ios - UITableView 页脚和页眉背景颜色比指定颜色深
- c++ - 如何在我的函数中保存变量以再次使用它?
- excel - 提取2个字符之间的字符串;不同的格式
- spring-boot - ClassNotFoundException 与 springboot 中的外部库
- r - 检查每个元素等价于 1