PHP rewind()Function


PHP Filesystem 参考手册Complete PHP Filesystem Reference Manual

Definition and Usage

The rewind() function rewinds the file pointer to the beginning of the file.

If successful, the function returns TRUE. If it fails, it returns FALSE.

Syntax

rewind(file)

Parameters Description
file Required. Specifies an open file.


Example

<?php
$file = fopen("test.txt","r");

//Change position of file pointer
fseek($file,"15");

//Set file pointer to 0
rewind($file);

fclose($file);
?>


PHP Filesystem 参考手册Complete PHP Filesystem Reference Manual Other Extensions