目录

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 文件系统参考