PHP ftell()Functions


PHP Filesystem 参考手册Complete PHP Filesystem Reference Manual

Definition and Usage

The ftell() function returns the current position in an open file.

Returns the current position of the file pointer, or FALSE on failure.

Syntax

ftell(file)

Parameters Description
file Required. Specifies the open file to be checked.


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);
?>

The above code will output:

0
15


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