PHP ftell () function
Definition and Usage
ftell () function returns the current position in the open file.
Returns the current position of the file pointer, on failure returns FALSE.
grammar
ftell(file)
参数 | 描述 |
---|---|
file | 必需。规定要检查的已打开文件。 |
Examples
<?php
$file = fopen("test.txt","r");
// print current position
echo ftell($file);
// change current position
fseek($file,"15");
// print current position again
echo "<br />" . ftell($file);
fclose($file);
?>
$file = fopen("test.txt","r");
// print current position
echo ftell($file);
// change current position
fseek($file,"15");
// print current position again
echo "<br />" . ftell($file);
fclose($file);
?>
The code above will output:
0
15
15
Complete PHP Filesystem Reference Manual