开发者

Is that possible to modify a few bytes of a big file without have to rewrite the entire file again?

Is that possible to modify a few bytes of a big file without have to rewrite the entire file again? If it is possible, 开发者_JS百科then how to do it? Or where I can find more information?


Yes. Use fseek and fgets to read only those bytes you need. Use fopen with an appropriate non-truncating mode, fseek again to the correct offset, and fwrite to write as many bytes as you need into the file.

Reference: PHP Manual: Filesystem Functions

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜