Questions about flock in PHP

Source: Internet
Author: User
Tags flock
Questions about flock in PHP
On Flock's question, I was on the blog as a whole, http://www.shionco.com/archives/php_flock.html

Routine Code:

$FD = fopen ('./a.html ', ' WB ');
if ($FD) {
if (@flock ($FD, lock_ex| LOCK_NB)) {
Echo ' unlocked, open file and lock ';
Sleep (10);
} else {
print ' Locked, close file ';
}
Fclose ($FD);
} else {
Echo ' failed to open file ';
}

I am under the FF, set up 2 pages, open the first page to run, the exclusive lock successfully, into the delay state, immediately open the 2nd page run, the results of the 2nd page blocked, until the 1th page run the end, 2nd page also exclusive lock success, into the delay state, executed, clearly used LOCK_NB, However, an exclusive lock failure has not occurred. Either a new tab or a new window will block!

However under IE (I use IE9, other not tested), the same process, the 2nd page of the direct exclusive lock failed, the output is "locked, close the file";

If so, would it not be blocked for FF clients to browse a large number of cached files where content updates have occurred?



------Solution--------------------
You can verify this and then create a file that contains the above code

Try opening these two files with a tabbed browser,,, to see if your needs are met. If it is, that's why.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.