dorantor / filelock
提供面向对象接口的简单PHP文件锁库。
v1.0.0
2017-10-24 13:25 UTC
Requires
- php: ^5.3|^7.0
This package is auto-updated.
Last update: 2024-09-29 04:42:59 UTC
README
提供面向对象接口的简单PHP文件锁库。
安装
composer require dorantor/filelock
用法
<?php // create lock object $lock = new \Dorantor\FileLock('path/to/file'); // ..and work with it if ($lock->acquire()) { // file is locked $lock->release(); } // ..or it could be if (!$lock->acquire()) { // failed with lock return; } // file was locked $lock->release();
致谢
想法、接口和部分代码不客气地借鉴自 benconstable/lock。