File opened by a script accessible by the user
I need to write a lot of data into a file while almost at the same time (at least at the time fil开发者_开发知识库e is still opened by fopen()
) user's browser needs to access it.
I found it's impossible until fclose()
or end of the script.
Is there any way to make it possible?
Perhaps its better to store the data in memory, or work with a temporary file. Then write to the master file at designated points rather then holding open the file for the entire execution of the script.
An option would be to send the file's mimetype to the user (text/plain
for example), and echo
the current file contents. After that you write both to the file and the output, so that the output to the user will mimic the file.
精彩评论