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
