HTTP 标头响应数据
我想计算 PHP 中 http 响应标头和数据的大小(以字节为单位)。 任何帮助将不胜感激
I want to calculate the size in bytes of the http response headers and data in PHP.
Any help would be appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无法通过 PHP 代码测量响应标头的大小,因为网络服务器可能会在提供响应标头之前对其进行更改。只有网络服务器可以测量这一点 - 并且您没有说明您正在使用什么网络服务器。使用 Apache,安装 mod_logio 并开始记录 %I、%O 和 %B
You can't measure the size of the response headers from your PHP code because the webserver may change them before serving them up. Only the webserver can measure this - and you don't say what webserver you are using. With Apache, install mod_logio and start recording %I, %O and %B