PHP code example of benconstable / lock
1. Go to this page and download the library: Download benconstable/lock library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
benconstable / lock example snippets
$lock = new BenConstable\Lock\Lock('/path/to/file.txt');
try {
$lock->acquire();
// Lock successful...
// Release lock. Optional, as resource will also be released automatically
// when the lock object is destroyed
$lock->release();
} catch (BenConstable\Lock\Exception\LockException $e) {
// Lock failed...
}