My PHP version is 5.2.1 For windows.
If browser doesn't support compressed ,
ob_start('ob_gzhandler') returns the original string,
but $str = ob_gzhandler ( $buffer, 5 ) returns false;
<?php /* 1.php */
ob_start('ob_gzhandler') ;
echo 'This is a string.';
?>
<?php
/* 2.php */
header("Content-Encoding: gzip");
$buffer = 'This is a string.';
$str = ob_gzhandler ( $buffer, 5 ) ;
if($str===false){
echo 'ob_gzhandler() returns false.';
}else{
echo $str;
}
?>
<?php
/* 3.php */
echo file_get_contents('http://www.php.net/1.php');
echo file_get_contents('http://www.php.net/2.php');
/*
result:
This is a string.ob_gzhandler() returns false.
*/
?>
我发表在php.net 官网手册上的 Note: ob_gzhandler() 函数
作者:faisun 发布日期:2007-04-25
http://cn.php.net/manual/en/function.ob-gzhandler.php
faisun at sina dot com 就是我啦 :)
ob_gzhandler
faisun at sina dot com 就是我啦 :)
ob_gzhandler
faisun at sina dot com
24-Apr-2007 12:53
24-Apr-2007 12:53
- 上一篇: 纯粹手写板 V1.3 算法简介
- 下一篇: 截取字符串时,截断HTML的问题