SplFileObject::fseek() - 文件处理
SplFileObject::fseek()
(PHP 5 >= 5.1.0, PHP 7)
Seek to a position
说明
publicSplFileObject::fseek(int $offset[,int $whence= SEEK_SET]): intSeek to a position in the file measured in bytes from the beginning of the file, obtained by adding$offsetto the position specified by$whence.
参数
$offsetThe offset. A negative value can be used to move backwards through the file which is useful when SEEK_END is used as the$whencevalue.
$whence$whencevalues are:
SEEK_SET
- Set position equal to$offsetbytes.SEEK_CUR
- Set position to current location plus$offset.SEEK_END
- Set position to end-of-file plus$offset.
If$whenceis not specified, it is assumed to be SEEK_SET
.
返回值
Returns 0 if the seek was successful,-1 otherwise. Note that seeking past EOF is not considered an error.
范例
SplFileObject::fseek() example
参见
fseek()
在文件指针中定位
鹏仔微信 15129739599 鹏仔QQ344225443 鹏仔前端 pjxi.com 共享博客 sharedbk.com
图片声明:本站部分配图来自网络。本站只作为美观性配图使用,无任何非法侵犯第三方意图,一切解释权归图片著作权方,本站不承担任何责任。如有恶意碰瓷者,必当奉陪到底严惩不贷!