自动摘要
正在生成中……
使用gzencode函数压缩,需要检查函数是否存在,因为可能php并没安装或启用该扩展。
if (isset($options['gzip_on_the_fly']) && $hyper_cache_gzip_accepted && function_exists('gzencode')) {
header('Cache-Control: private, max-age=0, no-cache, no-transform', false);
header('Vary: Accept-Encoding,User-Agent');
header('Content-Encoding: gzip');
header('X-Hyper-Cache: gzip on the fly', false);
return gzencode($buffer, 9);
}
判断客户端是否支持gzip压缩。
$hyper_cache_gzip_accepted = isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false;