streamWrapper::stream_lock()
(PHP 5, PHP 7)
Advisory file locking
说明
public streamWrapper::stream_lock(int $operation): bool
This method is called in response toflock(),whenfile_put_contents()(when$flagscontainsLOCK_EX),stream_set_blocking()and when closing the stream (LOCK_UN).
参数
- $operation
$operationis one of the following:
LOCK_SHto acquire a shared lock (reader).LOCK_EXto acquire an exclusive lock (writer).LOCK_UNto release a lock (shared or exclusive).LOCK_NBif you don't wantflock()to block while locking.(not supported on Windows)
返回值
成功时返回TRUE,或者在失败时返回FALSE。
错误/异常
EmitsE_WARNINGif call to this method fails (i.e. not implemented).
参见
stream_set_blocking()为资源流设置阻塞或者阻塞模式flock()轻便的咨询文件锁定
