Have you ever used
fflush
Function
The official explanation is that:
Flushes the output to a file
This function forces a write of all buffered output to the resource pointed to by the file handle.
This means that the write cache of the file is forcibly released to the file pointer.
http://php.net/manual/en/function.fflush.php
But I found that the content was written to the file immediately after Fwrite was executed. Do not need to fflush, also do not need fclose, to this question feel very puzzled, fflush actually has provided what function.
Code:
Reply content:
Have you ever used a fflush
function
The official explanation is that:
Flushes the output to a file
This function forces a write of all buffered output to the resource pointed to by the file handle.
This means that the write cache of the file is forcibly released to the file pointer.
http://php.net/manual/en/function.fflush.php
But I found that the content was written to the file immediately after Fwrite was executed. Do not need to fflush, also do not need fclose, to this question feel very puzzled, fflush actually has provided what function.
Code:
Refer you to a method Stream_set_write_ Buffer
, the default buffer_size
is 8 K
, that is, fwrite
If the amount of data written at one time is greater than Buffer_ A size of
, which splits the write. This situation needs to be considered when working with the same file in a multi-process, usually fflush
is not very useful, but it does not matter, after all, fopen
can also open other file
resources.