开发者

PHP Bz2 extension question

开发者 https://www.devze.com 2022-12-24 15:25 出处:网络
When I am using bzopen, do I need to bzwrite() alre开发者_StackOverflowady compressed by a bzcompress() string or is it being compressed automatically while writing?Judging by Example #1 on the manual

When I am using bzopen, do I need to bzwrite() alre开发者_StackOverflowady compressed by a bzcompress() string or is it being compressed automatically while writing?


Judging by Example #1 on the manual page of bzwrite (quoting) :

<?php
$str = "uncompressed data";
$bz = bzopen("/tmp/foo.bz2", "w");
bzwrite($bz, $str, strlen($str));
bzclose($bz);
?>

I would say there is no need to compress data yourself with bzcompress before using bzwrite.


Also, executing this portion of code will create a file with content that looks like this :

$ cat /tmp/foo.bz2
BZh91AY&SY7�w�@.� 1�&2��� q�o
|]��B@���`

Doesn't look like "uncompressed data" -- and looks like some bzip2-compressed data ;-)

0

精彩评论

暂无评论...
验证码 换一张
取 消