成人精品一区二区三区中文字幕-成人精品一区二区三区-成人精品一级毛片-成人精品亚洲-日本在线视频一区二区-日本在线视频免费

導航首頁 ? 技術教程 ? PHP:fseek()的用法_Filesystem函數
全站頭部文字 我要出現在這里
PHP:fseek()的用法_Filesystem函數 847 2023-12-15   

fseek

(PHP 4, PHP 5)

fseek — 在文件指針中定位

說明

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

在與 handle 關聯的文件中設定文件指針位置。 新位置從文件頭開始以字節數度量,是以 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() 創建的 resource(資源)。

offset

偏移量。

要移動到文件尾之前的位置,需要給 offset 傳遞一個負值,并設置 whenceSEEK_END

whence

whence values are: SEEK_SET - 設定位置等于 offset 字節。 SEEK_CUR - 設定位置為當前位置加上 offsetSEEK_END - 設定位置為文件尾加上 offset

返回值

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

范例

Example #1 fseek() 例子

<?php

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

// read some data
$data = fgets($fp, 4096);

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

?>

注釋

Note:

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

Note:

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.

參見

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


主站蜘蛛池模板: 华师大图书馆| 如果云知道歌词| 大奉打更人电视剧免费在线观看| 《桂花雨》课后题答案| 破冰 电影| 在线爱爱视频| 避幕 电影| 胡安·安东尼奥·萨马兰奇| 女孩们在线观看| 妈妈的脊背简谱| 宝宝乐园| 迅雷 电影| 曹东| 6夜间飞行的秘密| 成年黄色在线观看| jjdd| 恋人电影| 西界歌词| 山本裕典| 蜘蛛夫人:超感觉醒 电影| 林采薇| 黑帮之境| 麻辣烫热量| 刘峥| 陈澎| be小说| 外国开船戏原声| 阿尔罕布拉宫的回忆吉他谱| ktv视频| 大场久美子| 边缘战士| 自相矛盾视频故事视频| 弦月梦影| 老司机免费看视频| 大学生做爰视频直播| 肉体| 男生魔鬼训练压腿| 直播一级片| 显示驱动| 新上海滩张国荣和宁静| 欧美一级大胆视频|

!!!站長長期在線接!!!

網站、小程序:定制開發/二次開發/仿制開發等

各種疑難雜癥解決/定制接口/定制采集等

站長微信:lxwl520520

站長QQ:1737366103