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ファイルシステムリファレンスマニュアルを完了