PHP rewind() 函數

定義和用法

rewind() 函數將文件指針的位置倒回文件的開頭。

若成功,則返回 true。若失敗,則返回 false。

語法

rewind(file)
參數 描述
file 必需。規定已打開的文件。

實例

<?php
$file = fopen("test.txt","r");
//改變文件指針的位置
fseek($file,"15");
//把文件指針設定為 0
rewind($file);
fclose($file);
?>