(PHP 4, PHP 5, PHP 7)
fseek — ���ļ�ָ���ж�λ
$handle
, int $offset
[, int $whence
= SEEK_SET
] ) : int
����
handle
�������ļ����趨�ļ�ָ��λ�á�
��λ�ô��ļ�ͷ��ʼ���ֽ�������������
whence
ָ����λ�ü���
offset
��
In general, it is allowed to seek past the end-of-file; if data is then written, reads in any unwritten region between the end-of-file and the sought position will yield bytes with value 0. However, certain streams may not support this behavior, especially when they have an underlying fixed size storage.
�ɹ��� 0������ -1��ע���ƶ��� EOF ֮���λ�ò������
Example #1 fseek() ����
<?php
$fp = fopen('somefile.txt', 'r');
// read some data
$data = fgets($fp, 4096);
// move back to the beginning of the file
// same as rewind($fp);
fseek($fp, 0);
?>
Note:
���ʹ�ø���ģ�ԣ�a �� a+�����κ�д���ļ����ݶ��ᱻ������ȥ�����ļ���λ�ý��ᱻ���ԣ����� fseek() �Ľ����δ���塣
Note:
Not all streams support seeking. For those that do not support seeking, forward seeking from the current position is accomplished by reading and discarding data; other forms of seeking will fail.