首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

gzread

(PHP 4, PHP 5, PHP 7)

gzread - 读取二进制安全的 gz 文件

描述

代码语言:javascript
复制
string gzread ( resource $zp , int $length )

gzread() length从指定的 gz 文件指针读取字节。当读取length(未压缩)字节或到达 EOF 时,读取停止,以先到者为准。

参数

zp

gz 文件指针。它必须是有效的,并且必须指向由 gzopen() 成功打开的文件。

length

要读取的字节数。

返回值

已读取的数据。

例子

Example #1 gzread() example

代码语言:javascript
复制
<?php
// get contents of a gz-file into a string
$filename = "/usr/local/something.txt.gz";
$zd = gzopen($filename, "r");
$contents = gzread($zd, 10000);
gzclose($zd);
?>
  • gzwrite() - Binary-safe gz-file write
  • gzopen() - Open gz-file
  • gzgets() - Get line from file pointer
  • gzgetss() - Get line from gz-file pointer and strip HTML tags
  • gzfile() - Read entire gz-file into an array
  • gzpassthru() - Output all remaining data on a gz-file pointer

扫码关注腾讯云开发者

领取腾讯云代金券