PHP 教程 PHP ftell() 函数

vic · 2022-03-07 12:31:47 · 热度: 6

定义和用法

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);
?>

上面的代码将输出:

0
15

查看更多 PHP Filesystem 函数

猜你喜欢:
暂无回复。
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册