定義和用法
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);
?>
上面的代碼将輸出:
15