ftell()函数是php中的一个内置函数,用于返回打开文件中的当前位置。语法为ftell(file),该函数将file作为参数,在成功时返回当前文件指针位置,如果失败则返回false。
php ftell()函数怎么用?
php ftell()函数打开文件中的当前位置。
语法:
ftell(file)
参数:
● file:必需。规定要检查的已打开文件。
返回值:返回文件指针的当前位置,如果失败则返回 false。
下面通过示例来看看php ftell()函数的使用方法。
示例
<?php$file = fopen("test.txt","r");// print current positionecho ftell($file);// change current positionfseek($file,"15");// print current position againecho "<br />" . ftell($file);fclose($file);?>
输出:
015
以上就是php ftell函数怎么用的详细内容。