Home > Backend Development > PHP Tutorial > PHP的fwrite会并发执行

PHP的fwrite会并发执行

WBOY
Release: 2016-06-13 10:57:11
Original
1168 people have browsed it

PHP的fwrite能并发执行?

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->$f2 = fopen('file/index.txt','w');fwrite($f2,$h.$old);fclose($f2);
Copy after login


例如: 制作留言板. 没有使用MySQL等软件. 直接把留言写入一个.txt文件里.

如果在高峰时期, 同一秒内有50,000人留言. 
www.dbscripts.net/guestbook/demo/


PHP能并发执行, 不会出错?

------解决方案--------------------
出什么错?
你使用写方式打开的
file/index.txt 永远都是最后一个写的内容
------解决方案--------------------
写方式会覆盖吧
------解决方案--------------------
不知道.可能传说中的文件锁是解决之道
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template