include/common.inc.php 第86行
引用:
if($gzipcompress && function_exists('ob_gzhandler')) {
ob_start('ob_gzhandler');
} else {
$gzipcompress = 0;
ob_start();
}
include/global.func.php 第392行
引用:
$content = preg_replace($searcharray, $replacearray, ob_get_contents());
ob_end_clean();
$GLOBALS['gzipcompress'] ? ob_start('ob_gzhandler') : ob_start();
echo $content;
问:ob_start('ob_gzhandler') 跟 ob_start(), 用ob_get_contents()得到的结果是一样的吗?
答案是肯定的,因为在未真正输出之前并没有调用ob_gzhandler,
既然是一样的,何不把ob_start()放到common.inc.php的最开始,把gzipcompress判断放到output()函数里呢?
这样就可以减少headers already sent出现的机率了