fseek
(PHP 3, PHP 4, PHP 5)fseek -- 在文件指针中定位
说明
int fseek ( resource handle, int offset [, int whence] )
在与 handle 关联的文件中设定文件指针位置。新位置从文件头开始以字节数度量,是以 whence 指定的位置加上 offset。whence 的值定义为: 
SEEK_SET - 设定位置等于 offset 字节。 
SEEK_CUR - 设定位置为当前位置加上 offset。 
SEEK_END - 设定位置为文件尾加上 offset。(要移动到文件尾之前的位置,需要给 offset 传递一个负值。) 如果没有指定 whence,默认为 SEEK_SET。 成功则返回 0;否则返回 -1。注意移动到 EOF 之后的位置不算错误。 例子 1. fseek() 例子<?php$fp = fopen('somefile.txt', 'r');// read some data
$data = fgets($fp, 4096);// move back to the begining of the file
// same as rewind($fp);
fseek($fp, 0);