|
Posted by wesley on 09/28/75 11:45
Does fopen() and fclose() automatically unlock the file?
the code:
$fp = fopen("test.txt", "a");
if (flock($fp, 2)){
echo "We have locked the file</br>";
}
else {
echo "Some one else has locked the file</br>";
flock($fp, LOCK_UN);
echo "I have now released the lock</br>";
fwrite ($fp, "Hello, i have inserted after unlocking the file");
echo $string;
}
Basically, if the file is already locked, i will release the lock and
write to the file.
It doesnt do that ...
any suggestions?
Thanks Wes
Navigation:
[Reply to this message]
|