检测文件上传需要多长时间(PHP) [英] Detect how long it takes for a file to upload (PHP)
本文介绍了检测文件上传需要多长时间(PHP)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以(在服务器端)知道文件上传所花费的时间?我有一个图片上传API,在响应中,我想返回上传时间(不包括脚本执行时间).
Is it possible to know (serverside) the time it took for a file to upload? I have an image upload API and in my response I'd like to return the upload time (not including script execution time).
推荐答案
我认为是的,有$_SERVER['REQUEST_TIME']
变量指示HTTP请求的开始,因此在脚本的开头:
I think yes, there is $_SERVER['REQUEST_TIME']
variable that indicates the start of HTTP request, so on the very beginning of your script:
$upload_time = time() - $_SERVER['REQUEST_TIME'];
结果将以秒为单位.
这篇关于检测文件上传需要多长时间(PHP)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文