Questions about flock in PHP

Source: Internet
Author: User
Tags flock
For questions about flock in PHP and about flock, I wrote a blog on http://www.shionco.com/archives/php_flock.htmlexample code : ?fd=fopen ('. /a.html ', 'WB'); & nbsp; & n questions about flock in PHP
On the flock question, I am on the blog overall, 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 'The unlocked, open the file and lock it ';
Sleep (10 );
} Else {
Print 'locked, close file ';
}
Fclose ($ fd );
} Else {
Echo 'failed to open the file ';
}

Under FF, I created two pages to open the first page for operation. the exclusive lock was successful, and the latency status was displayed. I immediately opened 2nd pages for operation. as a result, page 2nd was blocked, when the 1st page is finished, the 2nd page is locked exclusively and enters the delayed status. after the execution is completed, LOCK_NB is clearly used, but no exclusive lock failure occurs. A new tab or window is blocked!

However, in IE (I am using IE9 but not tested), the 2nd page exclusive lock fails, and the output "locked, Close File ";

If so, will the FF client block a lot of browsing cached files with content updates?



------ Solution --------------------
You can perform this verification and create another file containing the above code.

Try to open these two files in a label-based browser to see if they meet your needs .. If yes, this is the reason

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.