开发者

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

开发者 https://www.devze.com 2023-03-24 13:30 出处:网络
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 fse

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

精彩评论

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