Phpflock function instance. Because flock () requires a file pointer, it may have to use a special lock file to protect access to the file to be opened in write mode (in fopen () adding w to the function or because flock () requires a file pointer, you may have to use a special lock file to protect access to files that are intended to be opened in write mode (in fopen () add "w" or "w +") to the function ").
Because flock () requires a file pointer, it may have to use a special lock file to protect access to the file to be opened in write mode (in fopen () add "w" or "w +") to the function ").
Fp = fopen ("test.txt", 'AB'); // from the end
Flock ($ fp, lock_ex); // lock the file for waiting...
Fwrite ($ fp, 'just a test string ...... '); // start writing...
Flock ($ fp, lock_un); // release write lock
Fclose ($ fp); // close the file read operation:
// Read
$ Fp = fopen ("test.txt", 'r ');
Flock ($ fp, lock_sh );
// Read from the file .......
Flock ($ fp, lock_un );