欧美AV无码一区二区,麻豆+无码+国产在线+观看,欧美狂躁少妇XXXX高潮无码,美女扒开屁股让男人桶免费观看,极品粉嫩国产18尤物在线播放

fseek

(PHP 4, PHP 5, PHP 7, PHP 8)

fseek在文件指針中定位

說(shuō)明

fseek(resource $handle, int $offset, int $whence = SEEK_SET): int

在與 handle 關(guān)聯(lián)的文件中設定文件指針位置。 新位置從文件頭開(kāi)始以字節數度量,是以 whence 指定的位置加上 offset。

In general, it is allowed to seek past the end-of-file; if data is then written, reads in any unwritten region between the end-of-file and the sought position will yield bytes with value 0. However, certain streams may not support this behavior, especially when they have an underlying fixed size storage.

參數

handle

文件系統指針,是典型地由 fopen() 創(chuàng )建的 resource(資源)。

offset

偏移量。

要移動(dòng)到文件尾之前的位置,需要給 offset 傳遞一個(gè)負值,并設置 whenceSEEK_END。

whence

whence values are:

  • SEEK_SET - 設定位置等于 offset 字節。
  • SEEK_CUR - 設定位置為當前位置加上 offset。
  • SEEK_END - 設定位置為文件尾加上 offset。

返回值

成功則返回 0;否則返回 -1。注意移動(dòng)到 EOF 之后的位置不算錯誤。

范例

示例 #1 fseek() 例子

<?php

$fp 
fopen('somefile.txt''r');

// read some data
$data fgets($fp4096);

// move back to the beginning of the file
// same as rewind($fp);
fseek($fp0);

?>

注釋

注意:

如果使用附加模試(aa+),任何寫(xiě)入文件數據都會(huì )被附加上去,而文件的位置將會(huì )被忽略,調用 fseek() 的結果尚未定義。

注意:

Not all streams support seeking. For those that do not support seeking, forward seeking from the current position is accomplished by reading and discarding data; other forms of seeking will fail.

參見(jiàn)

  • ftell() - 返回文件指針讀/寫(xiě)的位置
  • rewind() - 倒回文件指針的位置

欧美AV无码一区二区,麻豆+无码+国产在线+观看,欧美狂躁少妇XXXX高潮无码,美女扒开屁股让男人桶免费观看,极品粉嫩国产18尤物在线播放