首页 > 语言 > PHP > 正文

rewind函数怎么用

2024-09-04 11:49:42
字体:
来源:转载
供稿:网友

php rewind()函数倒回文件指针的位置。

php rewind()函数 语法

作用:将文件指针的位置倒回文件的开头。

语法:

rewind(file)

参数:

file 必需。规定已打开的文件。

说明:若成功,则返回 true。若失败,则返回 false。

php rewind()函数 示例:

  1. <?php 
  2.  
  3. $file = fopen("./test.txt","r"); 
  4.  
  5. //改变文件指针的位置 
  6.  
  7. fseek($file,"13"); 
  8.  
  9. //把文件指针设定为 0 
  10. //Vevb.com 
  11. rewind($file); 
  12.  
  13. //输出指针位置 
  14.  
  15. echo ftell($file); 
  16.  
  17. ?> 

本篇文章就是关于PHP rewind函数的介绍,希望对需要的朋友有所帮助!

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表