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

streamWrapper::stream_seek

(PHP 4 >= 4.3.2, PHP 5, PHP 7)

streamWrapper::stream_seek - 寻找流中的特定位置

描述

代码语言:javascript
复制
public bool streamWrapper::stream_seek ( int $offset , int $whence  = SEEK_SET )

这个方法在响应fseek()时被调用。

流的读/写位置应根据offset和更新whence

参数

offset

要寻求的流偏移量。

whence

可能的值:

  • SEEK_SET- 设置位置等于offset字节。
  • SEEK_CUR- 将位置设置为当前位置offset
  • SEEK_END- 将位置设置为文件结束加offset

返回值

如果位置已更新,则返回TRUE,否则返回FALSE

注意

注意:如果未实现,FALSE则假定为返回值。

注意:成功后,在调用streamWrapper::stream_seek()之后直接调用streamWrapper::stream_tell()。如果streamWrapper::stream_tell()失败,则调用者函数的返回值将被设置为FALSE

注意:并非所有在流上寻找操作都会导致调用此函数。PHP流默认启用了读缓冲(另请参阅stream_set_read_buffer()),只需移动缓冲区指针即可完成查找。

另请参阅

  • fseek() - 寻找文件指针

← streamWrapper::stream_read

streamWrapper::stream_set_option →

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com