Can PHP fwrite be executed concurrently?

Source: Internet
Author: User
Can PHP fwrite be executed concurrently?
$ F2 = fopen ('File/index.txt ', 'w'); fwrite ($ f2, $ h. $ old); fclose ($ f2 );


For example, I made a message board. I didn't use MySQL or other software. I directly wrote the message into a. txt file.

If 50,000 people leave messages within the same second during peak hours.
Www.dbscripts.net/guestbook/demo/


Can PHP be executed concurrently without errors?


Reply to discussion (solution)

What's wrong?
You use the write method to open
File/index.txt is always the last written content

The write method will overwrite it.

I don't know. maybe the legendary file lock is the solution.

Fopen ('File/index.txt ', 'w ');
This can also implement a message board ??
Is it too exaggerated to handle in one second ..................

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.