PHP ftell()関数
❮PHPファイルシステムリファレンス例
開いているファイル内の読み取り/書き込みポインタの現在の位置を返します。
<?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);
?>
定義と使用法
ftell()関数は、開いているファイル内の読み取り/書き込みポインタの現在の位置を返します。
構文
ftell(file)
パラメータ値
Parameter | Description |
---|---|
file | Required. Specifies the open file to check |
技術的な詳細
戻り値: | ファイルポインタの位置、または失敗した場合はFALSE。 |
---|---|
PHPバージョン: | 4.0以降 |
❮PHPファイルシステムリファレンス