
ftell()函数返回打开文件的当前位置。该函数返回当前文件指针位置。如果失败,则返回FALSE。
ftell(file_pointer)
file_pointer − 使用fopen()创建的文件指针。必需。
ftell()函数返回当前文件指针位置。如果失败,返回FALSE。
<?php
$file_pointer = fopen("new.txt","r");
echo ftell($file_pointer);
fclose($file_pointer);
?>0
让我们看另一个例子,其中当前位置被改变。
立即学习“PHP免费学习笔记(深入)”;
<?php
$file_pointer = fopen("new.txt","r");
// changing current position
fseek($file_pointer,"10");
// displaying current position
echo ftell($file_pointer);
fclose($file_pointer);
?>The following is the output. The current position is returned.
10
以上就是在PHP中的ftell()函数的详细内容,更多请关注php中文网其它相关文章!
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号