• 技术文章 >后端开发 >PHP问题

    php ftell函数怎么用

    青灯夜游青灯夜游2019-05-28 15:03:48原创832
    ftell()函数是PHP中的一个内置函数,用于返回打开文件中的当前位置。语法为ftell(file),该函数将file作为参数,在成功时返回当前文件指针位置,如果失败则返回FALSE。

    php ftell()函数怎么用?

    php ftell()函数打开文件中的当前位置。

    语法:

    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中文网,转载请注明出处,感谢您的尊重!如有疑问,请联系admin@php.cn处理
    专题推荐:php ftell函数
    上一篇:php fwrite函数怎么用 下一篇:php fputs函数怎么用
    线上培训班

    相关文章推荐

    • php asort函数怎么用• php arsort函数怎么用• php reset函数怎么用• php filesize函数怎么用

    全部评论我要评论

  • 取消发布评论发送
  • 1/1

    PHP中文网