rewind()

创建于 2024-12-03 / 33
字体: [默认] [大] [更大]
❮ PHP 文件系统参考手册

实例

将文件指针的位置回退到文件的开头:

<?php
$file = fopen("test.txt","r");

//Change position of file pointer
fseek($file,"15");

//Set file pointer to 0
rewind($file);

fclose($file);
?>

定义和用法

rewind() 函数将文件指针的位置倒回文件的开头。

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

语法

rewind(file)

参数值

参数 描述
file 必需。规定已打开的文件。


技术细节

返回值: 成功为 TRUE,失败为 FALSE
PHP 版本: 4.0+

❮ PHP 文件系统参考手册
0 人点赞过