PHP-确定通过HTTP发送多少字节 [英] PHP - determine how many bytes sent over http

查看:130
本文介绍了PHP-确定通过HTTP发送多少字节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在PHP中是否可以对传输到客户端的字节数进行计数?例如,如果我要输出一个10 MB的文件,是否有办法找出是否所有10 MB都发送给了客户端,或者查看客户端是否中途中断了传输?我知道Apache以后会记录下来,但是我想用PHP访问数据.

Is it possible in PHP to get a count of the number of bytes transmitted to the client? For example, if I'm outputting a 10 MB file, is there a way to find out if all 10 MB were sent to the client, or to see if the client interrupted the transfer partway? I know Apache will log this afterwards, but I'd like to access the data in PHP.

推荐答案

看看 ignore_user_abort connection_abort 功能.

Take a look at the ignore_user_abort and connection_abort function.

这篇关于PHP-确定通过HTTP发送多少字节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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