2024 日本 PHP 研討會

streamWrapper::stream_eof

(PHP 4 >= 4.3.2, PHP 5, PHP 7, PHP 8)

streamWrapper::stream_eof測試檔案指標是否已到達檔案結尾

說明

public streamWrapper::stream_eof(): bool

呼叫此方法以回應 feof()

參數

此函式沒有參數。

回傳值

如果讀/寫位置在串流結尾且沒有更多資料可讀取,則應回傳 true,否則回傳 false

注意事項

警告

當讀取整個檔案時(例如,使用 file_get_contents()),PHP 會在迴圈中呼叫 streamWrapper::stream_read(),然後呼叫 streamWrapper::stream_eof(),但只要 streamWrapper::stream_read() 回傳非空字串,streamWrapper::stream_eof() 的回傳值就會被忽略。

參見

  • feof() - 測試檔案指標是否已到達檔案結尾

新增註釋

使用者貢獻的註釋

此頁面沒有使用者貢獻的註釋。
To Top