简体   繁体   中英

PHP Bz2 extension question

当我使用bzopen ,我需要bzwrite()已经被压缩bzcompress()字符串或者它被写入时自动压缩?

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM