I can't seem to find an answer to this anywhere. It's well known that certain versions of IE6 and earlier incorrectly declare they accept gzip encoding. Does ob_gzhandler correctly detect these versions or do you need to do that separately?
我似乎无法在任何地方找到答案。众所周知,某些版本的IE6及更早版本错误地声明它们接受gzip编码。 ob_gzhandler是否正确检测到这些版本,或者您是否需要单独执行此操作?
1 个解决方案
#1
No, it doesn't; you have to, like so:
不,它没有;你必须这样:
<?
function checkIEFail() {
$ua = $_SERVER['HTTP_USER_AGENT'];
if(strpos($ua, 'Mozilla/4.0 (compatible; MSIE ') !== 0 || strpos($ua, 'Opera') !== false)
return false;
$version = floatval(substr($ua, 30));
return $version < 6 || ($version == 6 && strpos($ua, 'SV1') === false);
}
if(!checkIEFail())
ob_start('ob_gzhandler');
?>
#1
No, it doesn't; you have to, like so:
不,它没有;你必须这样:
<?
function checkIEFail() {
$ua = $_SERVER['HTTP_USER_AGENT'];
if(strpos($ua, 'Mozilla/4.0 (compatible; MSIE ') !== 0 || strpos($ua, 'Opera') !== false)
return false;
$version = floatval(substr($ua, 30));
return $version < 6 || ($version == 6 && strpos($ua, 'SV1') === false);
}
if(!checkIEFail())
ob_start('ob_gzhandler');
?>