You are here: File locking « All PHP « IT news, forums, messages
File locking

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация