Функция PHP ftell ()
Определение и использование
Функция ftell () возвращает текущую позицию в открытом файле.
Возвращает текущую позицию указателя файла, возвращается на провал FALSE.
грамматика
ftell(file)
参数 | 描述 |
---|---|
file | 必需。规定要检查的已打开文件。 |
примеров
<?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);
?>
Код выше вывод будет:
0
15
15
Полное PHP Filesystem Справочное руководство