卓越飞翔博客卓越飞翔博客

卓越飞翔 - 您值得收藏的技术分享站
技术文章16333本站已运行3317

在PHP中的ftell()函数

在PHP中的ftell()函数

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
   $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

卓越飞翔博客
上一篇: 解决Go语言网站访问速度问题的五大优化策略
下一篇: C++语言在嵌入式系统中实现高性能图像处理功能的方法
留言与评论(共有 0 条评论)
   
验证码:
隐藏边栏