从服务器上的多个位置访问文件(php / ajax)

I have a php script that opens a json file, rewrites it, then closes it. But there's also a site that needs to access that json file, so it's very likely that multiple users will be reading the contents of the json file with ajax while php is simultaneously changing the file.

I'm curious what this will do?

I'm assuming that it would cause some serious issues, would it be better to create a new file in php, make the changes, then rename and overwrite the old file?

The answer is, (unless you use flock : http://www.php.net/manual/en/function.flock.php) there will probably be versions writing over other versions whose data they did not capture. In other words, there is a high likelihood of data loss.