Last active
March 15, 2016 00:06
-
-
Save roscius/1b7de702db71a2ace2e6 to your computer and use it in GitHub Desktop.
File locking in PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $f = fopen('lock', 'w') or die ('Cannot create lock file'); | |
| if (flock($f, LOCK_EX | LOCK_NB)) { | |
| // yay | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment