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
精彩评论