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 ;-)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.