Php/docs/function.ftell
来自菜鸟教程
ftell
(PHP 4, PHP 5, PHP 7)
ftell — 返回文件指针读/写的位置
说明
ftell
( resource $handle
) : int
返回由 handle
指定的文件指针的位置,也就是文件流中的偏移量。
返回值
Returns the position of the file pointer referenced by
handle
as an integer; i.e., its offset into the file stream.
如果出错,返回 false
。
范例
Example #1 ftell() 例子
<?php// opens a file and read some data$fp = fopen("/etc/passwd", "r");$data = fgets($fp, 12);// where are we ?echo ftell($fp); // 11fclose($fp);?>