bzread
Description
Syntax
bzread( resource $bz, int $length = 1024 ): string|false
Parameters
bz
The file pointer. It must be valid and must point to a file successfully opened by bzopen().
length
If not specified, bzread() will read 1024 (uncompressed) bytes at a time. A maximum of 8192 uncompressed bytes will be read at a time.
Return
Returns the uncompressed data, or false on error.
Examples
1 · bz
<? $file = $_SERVER["DOCUMENT_ROOT"] . "/assets/bz2/1.bz2"; $mode = "r"; $bz = bzopen($file, $mode); if($bz === false) { die("bzopen"); } $return = ""; while(!feof($bz)) { $return .= bzread($bz); if($return === false) { die("bzread"); } } echo $return; bzclose($bz);
data
2 · length
<? $file = $_SERVER["DOCUMENT_ROOT"] . "/assets/bz2/1.bz2"; $mode = "r"; $bz = bzopen($file, $mode); if($bz === false) { die("bzopen"); } $return = ""; $length = 2; //while(!feof($bz)) //{ $return .= bzread($bz, $length); if($return === false) { die("bzread"); } //} echo $return; bzclose($bz);
da