sn01615 / file-lock
Php file lock tool.
v1.0.8
2023-05-25 10:54 UTC
This package is not auto-updated.
Last update: 2025-03-23 13:24:47 UTC
README
应用场景
- 限制只开启一个或有限个进程运行
局限性
只能在同一台服务器内生效 需要临时目录写入权限 (会在临时目录创建一个 _PHP_FileLock_xxx 类似的文件)
Install
composer require sn01615/file-lock
Usage
use PhpUtils\FileLock; # Get lock $status = FileLock::getLock('lockKey'); if ($status) { # Get lock success } else { # It's locked. } # Unlock FileLock::unlock('lockKey');