Jump to content

[SOLVED] Compression


cry of war

Recommended Posts

what about the manual!

zlib & wrappers compression &

ob_gzhandler

 

 

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.

*/

?>

Link to comment
https://forums.phpfreaks.com/topic/60355-solved-compression/#findComment-300288
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.