|
|
File locking - PHP
|
Views : 164
|
|
Tagged in : PHP
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
If two scripts tries to write on a same file simultaneously,problem occurs.To avoid this PHP gives concept called file locking.
Syntax for file locking
bool flock ( resource handle, int operation [, int &wouldblock])
where,
Handle
A file system pointer resource that is typically created using fopen().
Operation
* LOCK_SH to acquire a shared lock (reader).
* LOCK_EX to acquire an exclusive lock (writer).
* LOCK_UN to release a lock (shared or exclusive).
LOCK_NB operations is used if you don't want flock() to block while locking.
wouldblock
The optional third argument is set to TRUE if the lock would block .
|
|
By Kjanani, On - 2010-09-14 |
|
|
|