PHP rewind() 函數


PHP Filesystem 參考手冊 完整的 PHP Filesystem 參考手冊

定義和用法

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

如果成功,該函數返回 TRUE。如果失敗,則返回 FALSE。

語法

rewind(file)

參數 描述
file 必需。規定已打開的檔。


實例

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

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

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

fclose($file);
?>


PHP Filesystem 參考手冊 完整的 PHP Filesystem 參考手冊