ftell()函数是php中的一个内置函数,用于返回打开文件中的当前位置。语法为ftell(file),该函数将file作为参数,在成功时返回当前文件指针位置,如果失败则返回false。
php ftell()函数怎么用?
php ftell()函数打开文件中的当前位置。
语法:
立即学习“PHP免费学习笔记(深入)”;
ftell(file)
参数:
● file:必需。规定要检查的已打开文件。
返回值:返回文件指针的当前位置,如果失败则返回 FALSE。
下面通过示例来看看php ftell()函数的使用方法。
示例
<?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 ftell函数怎么用的详细内容,更多请关注php中文网其它相关文章!
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号