如何在服务器上启用HTTP_RANGE [英] How to enable the use of HTTP_RANGE on server
问题描述
如果我运行以下脚本来测试服务器上的HTTP_RANGE,我会得到一个否响应。我的LAMP服务器中有什么东西我需要为此设置给我一个是吗?我似乎无法找到关于此的任何信息,只能测试它是否存在。
If I run the following script to test for HTTP_RANGE on my server I get a 'no' response. Is there something in my LAMP server that I need to set for this to give me a yes? I can't seem to find any info regarding this, only how to test for it's existence.
<?php
if (isset($_SERVER['HTTP_RANGE'])) {
echo "yes";
} elseif (isset($_ENV['HTTP_RANGE'])) {
echo "yes";
} else {
echo "no";
}
推荐答案
此变量仅在客户端('用户代理')发出请求,询问某些字节范围(Accept-Ranges请求头)而不是整个文档。这些不是针对常规请求定义的。您确定您的用户代理要求字节范围吗?
This variable is only present if the client ('user agent') makes a request asking for certain range of bytes (a Accept-Ranges request header) instead of the whole document. These are not defined for regular requests. Are you sure that your user agent asks for byte range?
这篇关于如何在服务器上启用HTTP_RANGE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!