Flock
(PHP3 >= 3.0.7, PHP4)
Flock---&http://www.aliyun.com/zixun/aggregation/37954.html ">nbsp; File locked
Syntax: bool Flock (int fp, int twist [, int wouldblock])
Description:
PHP provides a hand-held (portable) locked way to make the complete file in a consulting channel (advisory Way).
Flock () operates on the open file metrics FP, twist can be one of the following values:
Set twist to Lock_sh to obtain a shared lock (read). (The version before PHP 4.0.1 is set to 1)
Set twist to LOCK_EX to obtain a unique lock (write). (The version before PHP 4.0.1 is set to 2)
Set twist to Lock_un to free a lock (shared or unique). (The version before PHP 4.0.1 is set to 3)
If you do not want to flock () The block, set the parameter twist to LOCK_NB. (The version before PHP 4.0.1 is set to 4)
Flock () allows you to perform a simple read/write approach that can be used on every platform (including UNIX and Windows). If the lock is able to block, the third option is set to True (Ewouldblock errno condition).
Flock () succeeds returns True, and returns false for failure.