我使用这样的代码:
//section with the important stuff for the client
ob_start();
echo "Blah... Random Content" . rand(1,1000);
$size = ob_get_length();
header("Content-Length: $size");
header('Connectio
我正在为客户端开发一个API脚本,并且他们需要其中一个服务来请求所需的内容长度。据我所知,PHP无法发送头中的Content-Length。我可能是错的,但是,如果没有它,我不断收到Premature end of data in tag html line 3 [string:Exception:private] => [code:protected] => 0 [file:protected]